fix(deps): update module github.com/vbauerster/mpb/v8 to v8.6.2

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
renovate[bot]
2023-10-14 05:10:56 +00:00
committed by GitHub
parent b5fec41f26
commit 74ed1d6e70
6 changed files with 59 additions and 66 deletions

2
go.mod
View File

@ -60,7 +60,7 @@ require (
github.com/stretchr/testify v1.8.4 github.com/stretchr/testify v1.8.4
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635
github.com/ulikunitz/xz v0.5.11 github.com/ulikunitz/xz v0.5.11
github.com/vbauerster/mpb/v8 v8.6.1 github.com/vbauerster/mpb/v8 v8.6.2
github.com/vishvananda/netlink v1.2.1-beta.2 github.com/vishvananda/netlink v1.2.1-beta.2
go.etcd.io/bbolt v1.3.7 go.etcd.io/bbolt v1.3.7
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 golang.org/x/exp v0.0.0-20230905200255-921286631fa9

4
go.sum
View File

@ -1026,8 +1026,8 @@ github.com/urfave/cli v1.22.12/go.mod h1:sSBEIC79qR6OvcmsD4U3KABeOTxDqQtdDnaFuUN
github.com/vbatts/tar-split v0.11.2/go.mod h1:vV3ZuO2yWSVsz+pfFzDG/upWH1JhjOiEaWq6kXyQ3VI= github.com/vbatts/tar-split v0.11.2/go.mod h1:vV3ZuO2yWSVsz+pfFzDG/upWH1JhjOiEaWq6kXyQ3VI=
github.com/vbatts/tar-split v0.11.5 h1:3bHCTIheBm1qFTcgh9oPu+nNBtX+XJIupG/vacinCts= github.com/vbatts/tar-split v0.11.5 h1:3bHCTIheBm1qFTcgh9oPu+nNBtX+XJIupG/vacinCts=
github.com/vbatts/tar-split v0.11.5/go.mod h1:yZbwRsSeGjusneWgA781EKej9HF8vme8okylkAeNKLk= github.com/vbatts/tar-split v0.11.5/go.mod h1:yZbwRsSeGjusneWgA781EKej9HF8vme8okylkAeNKLk=
github.com/vbauerster/mpb/v8 v8.6.1 h1:XbBpIbJxJOO9yMcKPpI4oEFPW6tLAptefNQJNcGWri8= github.com/vbauerster/mpb/v8 v8.6.2 h1:9EhnJGQRtvgDVCychJgR96EDCOqgg2NsMuk5JUcX4DA=
github.com/vbauerster/mpb/v8 v8.6.1/go.mod h1:S0tuIjikxlLxCeNijNhwAuD/BB3UE/d2nygG8SOldk0= github.com/vbauerster/mpb/v8 v8.6.2/go.mod h1:oVJ7T+dib99kZ/VBjoBaC8aPXiSAihnzuKmotuihyFo=
github.com/vishvananda/netlink v0.0.0-20181108222139-023a6dafdcdf/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk= github.com/vishvananda/netlink v0.0.0-20181108222139-023a6dafdcdf/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk=
github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE=
github.com/vishvananda/netlink v1.1.1-0.20201029203352-d40f9887b852/go.mod h1:twkDnbuQxJYemMlGd4JFIcuhgX83tXhKS2B/PRMpOho= github.com/vishvananda/netlink v1.1.1-0.20201029203352-d40f9887b852/go.mod h1:twkDnbuQxJYemMlGd4JFIcuhgX83tXhKS2B/PRMpOho=

View File

@ -61,7 +61,6 @@ type renderFrame struct {
shutdown int shutdown int
rmOnComplete bool rmOnComplete bool
noPop bool noPop bool
done bool
err error err error
} }
@ -82,10 +81,10 @@ func newBar(ctx context.Context, container *Progress, bs *bState) *Bar {
return bar return bar
} }
// ProxyReader wraps io.Reader with metrics required for progress tracking. // ProxyReader wraps io.Reader with metrics required for progress
// If `r` is 'unknown total/size' reader it's mandatory to call // tracking. If `r` is 'unknown total/size' reader it's mandatory
// (*Bar).SetTotal(-1, true) method after (io.Reader).Read returns io.EOF. // to call `(*Bar).SetTotal(-1, true)` after the wrapper returns
// If bar is already completed or aborted, returns nil. // `io.EOF`. If bar is already completed or aborted, returns nil.
// Panics if `r` is nil. // Panics if `r` is nil.
func (b *Bar) ProxyReader(r io.Reader) io.ReadCloser { func (b *Bar) ProxyReader(r io.Reader) io.ReadCloser {
if r == nil { if r == nil {
@ -177,11 +176,10 @@ func (b *Bar) TraverseDecorators(cb func(decor.Decorator)) {
} }
} }
// EnableTriggerComplete enables triggering complete event. It's // EnableTriggerComplete enables triggering complete event. It's effective
// effective only for bars which were constructed with `total <= 0` and // only for bars which were constructed with `total <= 0` and after total
// after total has been set with (*Bar).SetTotal(int64, false). If bar // has been set with `(*Bar).SetTotal(int64, false)`. If `curren >= total`
// has been incremented to the total, complete event is triggered right // at the moment of call, complete event is triggered right away.
// away.
func (b *Bar) EnableTriggerComplete() { func (b *Bar) EnableTriggerComplete() {
select { select {
case b.operateState <- func(s *bState) { case b.operateState <- func(s *bState) {
@ -200,11 +198,11 @@ func (b *Bar) EnableTriggerComplete() {
} }
} }
// SetTotal sets total to an arbitrary value. It's effective only for // SetTotal sets total to an arbitrary value. It's effective only for bar
// bar which was constructed with `total <= 0`. Setting total to negative // which was constructed with `total <= 0`. Setting total to negative value
// value is equivalent to (*Bar).SetTotal((*Bar).Current(), bool) but faster. // is equivalent to `(*Bar).SetTotal((*Bar).Current(), bool)` but faster. If
// If triggerCompletion is true, total value is set to current and // triggerCompletion is true, total value is set to current and complete
// complete event is triggered right away. // event is triggered right away.
func (b *Bar) SetTotal(total int64, triggerCompletion bool) { func (b *Bar) SetTotal(total int64, triggerCompletion bool) {
select { select {
case b.operateState <- func(s *bState) { case b.operateState <- func(s *bState) {
@ -344,7 +342,7 @@ func (b *Bar) SetPriority(priority int) {
// Abort interrupts bar's running goroutine. Abort won't be engaged // Abort interrupts bar's running goroutine. Abort won't be engaged
// if bar is already in complete state. If drop is true bar will be // if bar is already in complete state. If drop is true bar will be
// removed as well. To make sure that bar has been removed call // removed as well. To make sure that bar has been removed call
// (*Bar).Wait method. // `(*Bar).Wait()` method.
func (b *Bar) Abort(drop bool) { func (b *Bar) Abort(drop bool) {
select { select {
case b.operateState <- func(s *bState) { case b.operateState <- func(s *bState) {
@ -415,7 +413,6 @@ func (b *Bar) serve(ctx context.Context, bs *bState) {
} }
func (b *Bar) render(tw int) { func (b *Bar) render(tw int) {
var done bool
fn := func(s *bState) { fn := func(s *bState) {
var rows []io.Reader var rows []io.Reader
stat := newStatistics(tw, s) stat := newStatistics(tw, s)
@ -437,7 +434,6 @@ func (b *Bar) render(tw int) {
shutdown: s.shutdown, shutdown: s.shutdown,
rmOnComplete: s.rmOnComplete, rmOnComplete: s.rmOnComplete,
noPop: s.noPop, noPop: s.noPop,
done: done,
} }
if s.completed || s.aborted { if s.completed || s.aborted {
// post increment makes sure OnComplete decorators are rendered // post increment makes sure OnComplete decorators are rendered
@ -448,7 +444,6 @@ func (b *Bar) render(tw int) {
select { select {
case b.operateState <- fn: case b.operateState <- fn:
case <-b.done: case <-b.done:
done = true
fn(b.bs) fn(b.bs)
} }
} }

View File

@ -93,9 +93,9 @@ func WithAutoRefresh() ContainerOption {
} }
} }
// PopCompletedMode will pop completed bars to the top. // PopCompletedMode pop completed bars out of progress container.
// To stop rendering bar after it has been popped, use // In this mode completed bars get moved to the top and stop
// mpb.BarRemoveOnComplete() option on that bar. // participating in rendering cycle.
func PopCompletedMode() ContainerOption { func PopCompletedMode() ContainerOption {
return func(s *pState) { return func(s *pState) {
s.popCompleted = true s.popCompleted = true

View File

@ -18,8 +18,8 @@ const (
defaultRefreshRate = 150 * time.Millisecond defaultRefreshRate = 150 * time.Millisecond
) )
// DoneError represents an error when `*mpb.Progress` is done but its functionality is requested. // DoneError represents use after `(*Progress).Wait()` error.
var DoneError = fmt.Errorf("%T instance can't be reused after it's done", (*Progress)(nil)) var DoneError = fmt.Errorf("%T instance can't be reused after %[1]T.Wait()", (*Progress)(nil))
// Progress represents a container that renders one or more progress bars. // Progress represents a container that renders one or more progress bars.
type Progress struct { type Progress struct {
@ -55,13 +55,13 @@ type pState struct {
} }
// New creates new Progress container instance. It's not possible to // New creates new Progress container instance. It's not possible to
// reuse instance after (*Progress).Wait method has been called. // reuse instance after `(*Progress).Wait` method has been called.
func New(options ...ContainerOption) *Progress { func New(options ...ContainerOption) *Progress {
return NewWithContext(context.Background(), options...) return NewWithContext(context.Background(), options...)
} }
// NewWithContext creates new Progress container instance with provided // NewWithContext creates new Progress container instance with provided
// context. It's not possible to reuse instance after (*Progress).Wait // context. It's not possible to reuse instance after `(*Progress).Wait`
// method has been called. // method has been called.
func NewWithContext(ctx context.Context, options ...ContainerOption) *Progress { func NewWithContext(ctx context.Context, options ...ContainerOption) *Progress {
if ctx == nil { if ctx == nil {
@ -133,8 +133,7 @@ func (p *Progress) New(total int64, builder BarFillerBuilder, options ...BarOpti
// MustAdd creates a bar which renders itself by provided BarFiller. // MustAdd creates a bar which renders itself by provided BarFiller.
// If `total <= 0` triggering complete event by increment methods is // If `total <= 0` triggering complete event by increment methods is
// disabled. Panics if *Progress instance is done, i.e. called after // disabled. Panics if called after `(*Progress).Wait()`.
// (*Progress).Wait().
func (p *Progress) MustAdd(total int64, filler BarFiller, options ...BarOption) *Bar { func (p *Progress) MustAdd(total int64, filler BarFiller, options ...BarOption) *Bar {
bar, err := p.Add(total, filler, options...) bar, err := p.Add(total, filler, options...)
if err != nil { if err != nil {
@ -145,8 +144,8 @@ func (p *Progress) MustAdd(total int64, filler BarFiller, options ...BarOption)
// Add creates a bar which renders itself by provided BarFiller. // Add creates a bar which renders itself by provided BarFiller.
// If `total <= 0` triggering complete event by increment methods // If `total <= 0` triggering complete event by increment methods
// is disabled. If *Progress instance is done, i.e. called after // is disabled. If called after `(*Progress).Wait()` then
// (*Progress).Wait(), return error == DoneError. // `(nil, DoneError)` is returned.
func (p *Progress) Add(total int64, filler BarFiller, options ...BarOption) (*Bar, error) { func (p *Progress) Add(total int64, filler BarFiller, options ...BarOption) (*Bar, error) {
if filler == nil { if filler == nil {
filler = NopStyle().Build() filler = NopStyle().Build()
@ -203,7 +202,7 @@ func (p *Progress) traverseBars(cb func(b *Bar) bool) {
// UpdateBarPriority either immediately or lazy. // UpdateBarPriority either immediately or lazy.
// With lazy flag order is updated after the next refresh cycle. // With lazy flag order is updated after the next refresh cycle.
// If you don't care about laziness just use *Bar.SetPriority(int). // If you don't care about laziness just use `(*Bar).SetPriority(int)`.
func (p *Progress) UpdateBarPriority(b *Bar, priority int, lazy bool) { func (p *Progress) UpdateBarPriority(b *Bar, priority int, lazy bool) {
if b == nil { if b == nil {
return return
@ -215,9 +214,9 @@ func (p *Progress) UpdateBarPriority(b *Bar, priority int, lazy bool) {
} }
// Write is implementation of io.Writer. // Write is implementation of io.Writer.
// Writing to `*mpb.Progress` will print lines above a running bar. // Writing to `*Progress` will print lines above a running bar.
// Writes aren't flushed immediately, but at next refresh cycle. // Writes aren't flushed immediately, but at next refresh cycle.
// If Write is called after `*mpb.Progress` is done, `mpb.DoneError` // If called after `(*Progress).Wait()` then `(0, DoneError)`
// is returned. // is returned.
func (p *Progress) Write(b []byte) (int, error) { func (p *Progress) Write(b []byte) (int, error) {
type result struct { type result struct {
@ -238,7 +237,7 @@ func (p *Progress) Write(b []byte) (int, error) {
} }
// Wait waits for all bars to complete and finally shutdowns container. After // Wait waits for all bars to complete and finally shutdowns container. After
// this method has been called, there is no way to reuse (*Progress) instance. // this method has been called, there is no way to reuse `*Progress` instance.
func (p *Progress) Wait() { func (p *Progress) Wait() {
// wait for user wg, if any // wait for user wg, if any
if p.uwg != nil { if p.uwg != nil {
@ -249,9 +248,9 @@ func (p *Progress) Wait() {
p.Shutdown() p.Shutdown()
} }
// Shutdown cancels any running bar immediately and then shutdowns (*Progress) // Shutdown cancels any running bar immediately and then shutdowns `*Progress`
// instance. Normally this method shouldn't be called unless you know what you // instance. Normally this method shouldn't be called unless you know what you
// are doing. Proper way to shutdown is to call (*Progress).Wait() instead. // are doing. Proper way to shutdown is to call `(*Progress).Wait()` instead.
func (p *Progress) Shutdown() { func (p *Progress) Shutdown() {
p.cancel() p.cancel()
p.pwg.Wait() p.pwg.Wait()
@ -357,7 +356,7 @@ func (s *pState) render(cw *cwriter.Writer) (err error) {
func (s *pState) flush(cw *cwriter.Writer, height int) error { func (s *pState) flush(cw *cwriter.Writer, height int) error {
var wg sync.WaitGroup var wg sync.WaitGroup
defer wg.Wait() // waiting for all s.hm.push to complete defer wg.Wait() // waiting for all s.push to complete
var popCount int var popCount int
var rows []io.Reader var rows []io.Reader
@ -381,40 +380,34 @@ func (s *pState) flush(cw *cwriter.Writer, height int) error {
_, _ = io.Copy(io.Discard, row) _, _ = io.Copy(io.Discard, row)
} }
} }
if frame.shutdown != 0 && !frame.done {
switch frame.shutdown {
case 1:
b.cancel()
if qb, ok := s.queueBars[b]; ok { if qb, ok := s.queueBars[b]; ok {
b.cancel()
delete(s.queueBars, b) delete(s.queueBars, b)
qb.priority = b.priority qb.priority = b.priority
wg.Add(1) wg.Add(1)
go func(b *Bar) { go s.push(&wg, qb, true)
s.hm.push(b, true) } else if s.popCompleted && !frame.noPop {
wg.Done() b.priority = s.popPriority
}(qb) s.popPriority++
continue wg.Add(1)
go s.push(&wg, b, false)
} else if !frame.rmOnComplete {
wg.Add(1)
go s.push(&wg, b, false)
} }
case 2:
if s.popCompleted && !frame.noPop { if s.popCompleted && !frame.noPop {
switch frame.shutdown { popCount += usedRows
case 1:
b.priority = s.popPriority
s.popPriority++
default:
b.cancel()
popCount += usedRows
continue
}
} else if frame.rmOnComplete {
b.cancel()
continue continue
} else {
b.cancel()
} }
fallthrough
default:
wg.Add(1)
go s.push(&wg, b, false)
} }
wg.Add(1)
go func(b *Bar) {
s.hm.push(b, false)
wg.Done()
}(b)
} }
for i := len(rows) - 1; i >= 0; i-- { for i := len(rows) - 1; i >= 0; i-- {
@ -427,6 +420,11 @@ func (s *pState) flush(cw *cwriter.Writer, height int) error {
return cw.Flush(len(rows) - popCount) return cw.Flush(len(rows) - popCount)
} }
func (s pState) push(wg *sync.WaitGroup, b *Bar, sync bool) {
s.hm.push(b, sync)
wg.Done()
}
func (s pState) makeBarState(total int64, filler BarFiller, options ...BarOption) *bState { func (s pState) makeBarState(total int64, filler BarFiller, options ...BarOption) *bState {
bs := &bState{ bs := &bState{
id: s.idCount, id: s.idCount,

2
vendor/modules.txt vendored
View File

@ -1004,7 +1004,7 @@ github.com/ulikunitz/xz/lzma
github.com/vbatts/tar-split/archive/tar github.com/vbatts/tar-split/archive/tar
github.com/vbatts/tar-split/tar/asm github.com/vbatts/tar-split/tar/asm
github.com/vbatts/tar-split/tar/storage github.com/vbatts/tar-split/tar/storage
# github.com/vbauerster/mpb/v8 v8.6.1 # github.com/vbauerster/mpb/v8 v8.6.2
## explicit; go 1.17 ## explicit; go 1.17
github.com/vbauerster/mpb/v8 github.com/vbauerster/mpb/v8
github.com/vbauerster/mpb/v8/cwriter github.com/vbauerster/mpb/v8/cwriter