Files
podman/vendor/github.com/vbauerster/mpb/proxyreader.go
Valentin Rothberg c069d11759 vendor containers/image v1.4
This requires some additional changes to the dependencies since the
progress-bar library has been changed to github.com/vbauerster/mpb.

Please refer to the following link for the release notes:
https://github.com/containers/image/releases/tag/v1.4

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-02-21 11:54:04 +01:00

23 lines
341 B
Go

package mpb
import (
"io"
"time"
)
// proxyReader is io.Reader wrapper, for proxy read bytes
type proxyReader struct {
io.ReadCloser
bar *Bar
iT time.Time
}
func (pr *proxyReader) Read(p []byte) (n int, err error) {
n, err = pr.ReadCloser.Read(p)
if n > 0 {
pr.bar.IncrBy(n, time.Since(pr.iT))
pr.iT = time.Now()
}
return
}