(p *io.PipeWriter)
| 402 | } |
| 403 | |
| 404 | func (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 | |
| 425 | func (pw *pushWriter) Write(p []byte) (n int, err error) { |
| 426 | status, err := pw.tracker.GetStatus(pw.ref) |
no test coverage detected