Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Callback ¶
Callback is a function that provides progress information copying from a Reader to a Writer
func BarCallback ¶
BarCallback returns a progress bar callback unless e.g. --quiet or lower loglevel is set
type DownloadBar ¶
type DownloadBar struct {
// contains filtered or unexported fields
}
DownloadBar is a progress bar that implements the scs-library-client ProgressBar interface.
func (*DownloadBar) Abort ¶
func (dpb *DownloadBar) Abort(drop bool)
func (*DownloadBar) IncrBy ¶
func (dpb *DownloadBar) IncrBy(n int)
func (*DownloadBar) Init ¶
func (dpb *DownloadBar) Init(contentLength int64)
func (*DownloadBar) ProxyReader ¶
func (dpb *DownloadBar) ProxyReader(r io.Reader) io.ReadCloser
func (*DownloadBar) Wait ¶
func (dpb *DownloadBar) Wait()
type RoundTripper ¶
type RoundTripper struct {
// contains filtered or unexported fields
}
func NewRoundTripper ¶
func NewRoundTripper(ctx context.Context, inner http.RoundTripper) *RoundTripper
NewRoundTripper wraps inner (or http.DefaultTransport if inner is nil) with progress bar functionality. A separate bar will be displayed for every GET request that returns a body >64KiB, updated as the response body is read. The caller is responsible for calling rt.ProgressWait / rt.ProgressShutdown when all requests are completed, so that the mpb progress container exits correctly. Note that if requests are made, but the response body is not read, the progress bar will remain 'stuck', preventing rt.ProgressWait from returning. rt.ProgressComplete is provided to override all bars to be 100% complete, to satisfy rt.ProgressWait where appropriate.
func (*RoundTripper) ProgressComplete ¶ added in v4.1.0
func (t *RoundTripper) ProgressComplete()
ProgressComplete overrides all progress bars, setting them to 100% complete.
func (*RoundTripper) ProgressShutdown ¶ added in v4.1.0
func (t *RoundTripper) ProgressShutdown()
ProgressShutdown immediately shuts down the mpb Progress container.
func (*RoundTripper) ProgressWait ¶ added in v4.1.0
func (t *RoundTripper) ProgressWait()
ProgressWait shuts down the mpb Progress container by waiting for all bars to complete.