MCPcopy
hub / github.com/perkeep/perkeep / getBlob

Method getBlob

pkg/schema/filereader.go:257–276  ·  view source on GitHub ↗
(ctx context.Context, br blob.Ref)

Source from the content-addressed store, hash-verified

255}
256
257func (fr *FileReader) getBlob(ctx context.Context, br blob.Ref) (*blob.Blob, error) {
258 if root := fr.rootReader(); root != fr {
259 return root.getBlob(ctx, br)
260 }
261 fr.blobmu.Lock()
262 last := fr.lastBlob
263 fr.blobmu.Unlock()
264 if last != nil && last.Ref() == br {
265 return last, nil
266 }
267 blob, err := blob.FromFetcher(ctx, fr.fetcher, br)
268 if err != nil {
269 return nil, err
270 }
271
272 fr.blobmu.Lock()
273 fr.lastBlob = blob
274 fr.blobmu.Unlock()
275 return blob, nil
276}
277
278func (fr *FileReader) getSuperset(ctx context.Context, br blob.Ref) (*superset, error) {
279 if root := fr.rootReader(); root != fr {

Callers 1

readerForOffsetMethod · 0.95

Calls 5

rootReaderMethod · 0.95
FromFetcherFunction · 0.92
LockMethod · 0.80
UnlockMethod · 0.80
RefMethod · 0.80

Tested by

no test coverage detected