MCPcopy
hub / github.com/kopia/kopia / getPartialCacheHit

Method getPartialCacheHit

internal/cache/persistent_lru_cache.go:98–114  ·  view source on GitHub ↗
(ctx context.Context, key string, length int64, output *gather.WriteBuffer)

Source from the content-addressed store, hash-verified

96}
97
98func (c *PersistentCache) getPartialCacheHit(ctx context.Context, key string, length int64, output *gather.WriteBuffer) {
99 // cache hit
100 c.reportHitBytes(int64(output.Length()))
101
102 mtime, err := c.cacheStorage.TouchBlob(ctx, blob.ID(key), c.sweep.TouchThreshold)
103
104 c.listCacheMutex.Lock()
105 defer c.listCacheMutex.Unlock()
106
107 if err == nil {
108 c.listCache.AddOrUpdate(blob.Metadata{
109 BlobID: blob.ID(key),
110 Length: length,
111 Timestamp: mtime,
112 })
113 }
114}
115
116func (c *PersistentCache) deleteInvalidBlob(ctx context.Context, key string) {
117 if err := c.cacheStorage.DeleteBlob(ctx, blob.ID(key)); err != nil && !errors.Is(err, blob.ErrBlobNotFound) {

Callers 1

getPartialMethod · 0.95

Calls 7

IDTypeAlias · 0.92
reportHitBytesMethod · 0.80
AddOrUpdateMethod · 0.80
LengthMethod · 0.65
TouchBlobMethod · 0.65
LockMethod · 0.65
UnlockMethod · 0.65

Tested by

no test coverage detected