MCPcopy
hub / github.com/perkeep/perkeep / WriteFileChunks

Function WriteFileChunks

pkg/schema/filewriter.go:276–289  ·  view source on GitHub ↗

WriteFileChunks uploads chunks of r to bs while populating file. It does not upload file.

(ctx context.Context, bs blobserver.StatReceiver, file *Builder, r io.Reader)

Source from the content-addressed store, hash-verified

274// WriteFileChunks uploads chunks of r to bs while populating file.
275// It does not upload file.
276func WriteFileChunks(ctx context.Context, bs blobserver.StatReceiver, file *Builder, r io.Reader) error {
277 size, spans, err := writeFileChunks(ctx, bs, file, r)
278 if err != nil {
279 return err
280 }
281 parts := []BytesPart{}
282 future := newUploadBytesFuture()
283 addBytesParts(ctx, bs, &parts, spans, future)
284 future.errc <- nil // Get will still block on addBytesParts' children
285 if _, err := future.Get(); err != nil {
286 return err
287 }
288 return file.PopulateParts(size, parts)
289}
290
291func writeFileChunks(ctx context.Context, bs blobserver.StatReceiver, file *Builder, r io.Reader) (n int64, spans []span, outerr error) {
292 src := &noteEOFReader{r: r}

Callers 1

uploadNodeRegularFileMethod · 0.92

Calls 5

writeFileChunksFunction · 0.85
newUploadBytesFutureFunction · 0.85
addBytesPartsFunction · 0.85
PopulatePartsMethod · 0.80
GetMethod · 0.65

Tested by

no test coverage detected