mirror of
https://github.com/containers/podman.git
synced 2025-12-02 19:28:58 +08:00
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>
23 lines
341 B
Go
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
|
|
}
|