MCPcopy
hub / github.com/containerd/containerd / replacePipe

Method replacePipe

core/remotes/docker/pusher.go:404–423  ·  view source on GitHub ↗
(p *io.PipeWriter)

Source from the content-addressed store, hash-verified

402}
403
404func (pw *pushWriter) replacePipe(p *io.PipeWriter) error {
405 if pw.pipe == nil {
406 pw.pipe = p
407 return nil
408 }
409
410 pw.pipe.CloseWithError(content.ErrReset)
411 pw.pipe = p
412
413 // If content has already been written, the bytes
414 // cannot be written again and the caller must reset
415 status, err := pw.tracker.GetStatus(pw.ref)
416 if err != nil {
417 return err
418 }
419 status.Offset = 0
420 status.UpdatedAt = time.Now()
421 pw.tracker.SetStatus(pw.ref, status)
422 return content.ErrReset
423}
424
425func (pw *pushWriter) Write(p []byte) (n int, err error) {
426 status, err := pw.tracker.GetStatus(pw.ref)

Callers 2

WriteMethod · 0.95
CommitMethod · 0.95

Calls 3

GetStatusMethod · 0.65
SetStatusMethod · 0.65
CloseWithErrorMethod · 0.45

Tested by

no test coverage detected