MCPcopy
hub / github.com/kopia/kopia / fetchBlobInternal

Method fetchBlobInternal

internal/cache/content_cache.go:97–111  ·  view source on GitHub ↗
(ctx context.Context, blobID blob.ID, blobData *gather.WriteBuffer)

Source from the content-addressed store, hash-verified

95}
96
97func (c *contentCacheImpl) fetchBlobInternal(ctx context.Context, blobID blob.ID, blobData *gather.WriteBuffer) error {
98 // read the entire blob
99 if err := c.st.GetBlob(ctx, blobID, 0, -1, blobData); err != nil {
100 c.pc.reportMissError()
101
102 return errors.Wrapf(err, "failed to get blob with ID %s", blobID)
103 }
104
105 c.pc.reportMissBytes(int64(blobData.Length()))
106
107 // store the whole blob in the cache.
108 c.pc.Put(ctx, BlobIDCacheKey(blobID), blobData.Bytes())
109
110 return nil
111}
112
113func (c *contentCacheImpl) getContentFromFullOrPartialBlob(ctx context.Context, contentID string, blobID blob.ID, offset, length int64, output *gather.WriteBuffer) error {
114 // acquire shared lock on a blob, PrefetchBlob will acquire exclusive lock here.

Callers 2

PrefetchBlobMethod · 0.95

Calls 7

BlobIDCacheKeyFunction · 0.85
reportMissErrorMethod · 0.80
reportMissBytesMethod · 0.80
GetBlobMethod · 0.65
LengthMethod · 0.65
PutMethod · 0.65
BytesMethod · 0.45

Tested by

no test coverage detected