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

Method ReceiveBlob

pkg/client/get.go:192–211  ·  view source on GitHub ↗
(ctx context.Context, br blob.Ref, source io.Reader)

Source from the content-addressed store, hash-verified

190}
191
192func (c *Client) ReceiveBlob(ctx context.Context, br blob.Ref, source io.Reader) (blob.SizedRef, error) {
193 if c.sto != nil {
194 return blobserver.Receive(ctx, c.sto, br, source)
195 }
196 size, ok := readerutil.Size(source)
197 if !ok {
198 size = 0
199 }
200 h := &UploadHandle{
201 BlobRef: br,
202 Size: uint32(size), // 0 if we don't know
203 Contents: source,
204 SkipStat: true,
205 }
206 pr, err := c.Upload(ctx, h)
207 if err != nil {
208 return blob.SizedRef{}, err
209 }
210 return pr.SizedBlobRef(), nil
211}

Callers 1

fileMapFromDuplicateMethod · 0.95

Calls 4

UploadMethod · 0.95
ReceiveFunction · 0.92
SizedBlobRefMethod · 0.80
SizeMethod · 0.65

Tested by

no test coverage detected