mirror of
https://github.com/containers/podman.git
synced 2026-07-17 10:41:58 -04:00
Bumps [github.com/containers/image/v5](https://github.com/containers/image) from 5.0.0 to 5.1.0. - [Release notes](https://github.com/containers/image/releases) - [Commits](https://github.com/containers/image/compare/v5.0.0...v5.1.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
46 lines
694 B
Go
46 lines
694 B
Go
package mpb
|
|
|
|
import (
|
|
"io"
|
|
"time"
|
|
)
|
|
|
|
type proxyReader struct {
|
|
io.ReadCloser
|
|
bar *Bar
|
|
iT time.Time
|
|
}
|
|
|
|
func (prox *proxyReader) Read(p []byte) (n int, err error) {
|
|
n, err = prox.ReadCloser.Read(p)
|
|
if n > 0 {
|
|
prox.bar.IncrBy(n, time.Since(prox.iT))
|
|
prox.iT = time.Now()
|
|
}
|
|
if err == io.EOF {
|
|
go func() {
|
|
prox.bar.SetTotal(0, true)
|
|
}()
|
|
}
|
|
return
|
|
}
|
|
|
|
type proxyWriterTo struct {
|
|
*proxyReader
|
|
wt io.WriterTo
|
|
}
|
|
|
|
func (prox *proxyWriterTo) WriteTo(w io.Writer) (n int64, err error) {
|
|
n, err = prox.wt.WriteTo(w)
|
|
if n > 0 {
|
|
prox.bar.IncrInt64(n, time.Since(prox.iT))
|
|
prox.iT = time.Now()
|
|
}
|
|
if err == io.EOF {
|
|
go func() {
|
|
prox.bar.SetTotal(0, true)
|
|
}()
|
|
}
|
|
return
|
|
}
|