MCPcopy Index your code
hub / github.com/perkeep/perkeep / SubFetch

Method SubFetch

pkg/blobserver/proxycache/proxycache.go:177–191  ·  view source on GitHub ↗
(ctx context.Context, ref blob.Ref, offset, length int64)

Source from the content-addressed store, hash-verified

175}
176
177func (sto *Storage) SubFetch(ctx context.Context, ref blob.Ref, offset, length int64) (io.ReadCloser, error) {
178 if sf, ok := sto.cache.(blob.SubFetcher); ok {
179 rc, err := sf.SubFetch(ctx, ref, offset, length)
180 if err == nil {
181 return rc, nil
182 }
183 if err != os.ErrNotExist && err != blob.ErrUnimplemented {
184 log.Printf("proxycache: error fetching from cache %T: %v", sto.cache, err)
185 }
186 }
187 if sf, ok := sto.origin.(blob.SubFetcher); ok {
188 return sf.SubFetch(ctx, ref, offset, length)
189 }
190 return nil, blob.ErrUnimplemented
191}
192
193func (sto *Storage) StatBlobs(ctx context.Context, blobs []blob.Ref, fn func(blob.SizedRef) error) error {
194 need := map[blob.Ref]bool{}

Callers

nothing calls this directly

Calls 2

PrintfMethod · 0.80
SubFetchMethod · 0.65

Tested by

no test coverage detected