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

Method Fetch

pkg/blobserver/mongo/fetch.go:29–39  ·  view source on GitHub ↗
(ctx context.Context, ref blob.Ref)

Source from the content-addressed store, hash-verified

27)
28
29func (m *mongoStorage) Fetch(ctx context.Context, ref blob.Ref) (io.ReadCloser, uint32, error) {
30 var b blobDoc
31 err := m.c.Find(bson.M{"key": ref.String()}).One(&b)
32 if err != nil {
33 return nil, 0, err
34 }
35 if len(b.Blob) != int(b.Size) {
36 return nil, 0, fmt.Errorf("blob data size %d doesn't match meta size %d", len(b.Blob), b.Size)
37 }
38 return io.NopCloser(bytes.NewReader(b.Blob)), b.Size, nil
39}

Callers

nothing calls this directly

Calls 2

FindMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected