cache: temporarily remove updateLastUsed
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>docker-18.09
parent
b6c782d53e
commit
69097924af
|
@ -185,22 +185,24 @@ func getLastUsed(si *metadata.StorageItem) (int, *time.Time) {
|
|||
return usageCount, &tm
|
||||
}
|
||||
|
||||
func updateLastUsed(si *metadata.StorageItem) error {
|
||||
count, _ := getLastUsed(si)
|
||||
count++
|
||||
|
||||
v, err := metadata.NewValue(count)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to create usageCount value")
|
||||
}
|
||||
v2, err := metadata.NewValue(time.Now().UnixNano())
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to create lastUsedAt value")
|
||||
}
|
||||
return si.Update(func(b *bolt.Bucket) error {
|
||||
if err := si.SetValue(b, keyUsageCount, v); err != nil {
|
||||
return err
|
||||
}
|
||||
return si.SetValue(b, keyLastUsedAt, v2)
|
||||
})
|
||||
}
|
||||
// TODO: temporarily removed until there is an implementation that can do this
|
||||
// on background or one that doesn't get new refs for every operation
|
||||
// func updateLastUsed(si *metadata.StorageItem) error {
|
||||
// count, _ := getLastUsed(si)
|
||||
// count++
|
||||
//
|
||||
// v, err := metadata.NewValue(count)
|
||||
// if err != nil {
|
||||
// return errors.Wrap(err, "failed to create usageCount value")
|
||||
// }
|
||||
// v2, err := metadata.NewValue(time.Now().UnixNano())
|
||||
// if err != nil {
|
||||
// return errors.Wrap(err, "failed to create lastUsedAt value")
|
||||
// }
|
||||
// return si.Update(func(b *bolt.Bucket) error {
|
||||
// if err := si.SetValue(b, keyUsageCount, v); err != nil {
|
||||
// return err
|
||||
// }
|
||||
// return si.SetValue(b, keyLastUsedAt, v2)
|
||||
// })
|
||||
// }
|
||||
|
|
|
@ -204,7 +204,7 @@ func (sr *immutableRef) Release(ctx context.Context) error {
|
|||
}
|
||||
|
||||
func (sr *immutableRef) release(ctx context.Context) error {
|
||||
updateLastUsed(sr.md)
|
||||
// updateLastUsed(sr.md)
|
||||
|
||||
delete(sr.refs, sr)
|
||||
|
||||
|
@ -325,7 +325,7 @@ func (sr *mutableRef) Release(ctx context.Context) error {
|
|||
|
||||
func (sr *mutableRef) release(ctx context.Context) error {
|
||||
delete(sr.refs, sr)
|
||||
updateLastUsed(sr.md)
|
||||
// updateLastUsed(sr.md)
|
||||
if getCachePolicy(sr.md) != cachePolicyRetain {
|
||||
if sr.equalImmutable != nil {
|
||||
if getCachePolicy(sr.equalImmutable.md) == cachePolicyRetain {
|
||||
|
|
Loading…
Reference in New Issue