MCPcopy
hub / github.com/perkeep/perkeep / ReceiveBlob

Method ReceiveBlob

pkg/blobserver/remote/remote.go:117–129  ·  view source on GitHub ↗
(ctx context.Context, blob blob.Ref, source io.Reader)

Source from the content-addressed store, hash-verified

115}
116
117func (sto *remoteStorage) ReceiveBlob(ctx context.Context, blob blob.Ref, source io.Reader) (outsb blob.SizedRef, outerr error) {
118 h := &client.UploadHandle{
119 BlobRef: blob,
120 Size: 0, // size isn't known; 0 is fine, but TODO: ask source if it knows its size
121 Contents: source,
122 }
123 pr, err := sto.client.Upload(ctx, h)
124 if err != nil {
125 outerr = err
126 return
127 }
128 return pr.SizedBlobRef(), nil
129}
130
131func (sto *remoteStorage) Fetch(ctx context.Context, b blob.Ref) (file io.ReadCloser, size uint32, err error) {
132 return sto.client.Fetch(ctx, b)

Callers

nothing calls this directly

Calls 2

SizedBlobRefMethod · 0.80
UploadMethod · 0.45

Tested by

no test coverage detected