mirror of
https://github.com/containers/podman.git
synced 2025-11-30 18:18:18 +08:00
fix(deps): update module github.com/vbauerster/mpb/v8 to v8.10.2
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
20
vendor/github.com/vbauerster/mpb/v8/bar.go
generated
vendored
20
vendor/github.com/vbauerster/mpb/v8/bar.go
generated
vendored
@@ -145,13 +145,7 @@ func (b *Bar) Current() int64 {
|
||||
// operation for example.
|
||||
func (b *Bar) SetRefill(amount int64) {
|
||||
select {
|
||||
case b.operateState <- func(s *bState) {
|
||||
if amount < s.current {
|
||||
s.refill = amount
|
||||
} else {
|
||||
s.refill = s.current
|
||||
}
|
||||
}:
|
||||
case b.operateState <- func(s *bState) { s.refill = min(amount, s.current) }:
|
||||
case <-b.ctx.Done():
|
||||
}
|
||||
}
|
||||
@@ -275,10 +269,10 @@ func (b *Bar) EwmaIncrInt64(n int64, iterDur time.Duration) {
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(len(s.ewmaDecorators))
|
||||
for _, d := range s.ewmaDecorators {
|
||||
d := d
|
||||
// d := d // NOTE: uncomment for Go < 1.22, see /doc/faq#closures_and_goroutines
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
d.EwmaUpdate(n, iterDur)
|
||||
wg.Done()
|
||||
}()
|
||||
}
|
||||
s.current += n
|
||||
@@ -304,10 +298,10 @@ func (b *Bar) EwmaSetCurrent(current int64, iterDur time.Duration) {
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(len(s.ewmaDecorators))
|
||||
for _, d := range s.ewmaDecorators {
|
||||
d := d
|
||||
// d := d // NOTE: uncomment for Go < 1.22, see /doc/faq#closures_and_goroutines
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
d.EwmaUpdate(n, iterDur)
|
||||
wg.Done()
|
||||
}()
|
||||
}
|
||||
s.current = current
|
||||
@@ -394,13 +388,14 @@ func (b *Bar) Wait() {
|
||||
}
|
||||
|
||||
func (b *Bar) serve(bs *bState) {
|
||||
defer b.container.bwg.Done()
|
||||
decoratorsOnShutdown := func(group []decor.Decorator) {
|
||||
for _, d := range group {
|
||||
if d, ok := unwrap(d).(decor.ShutdownListener); ok {
|
||||
b.container.bwg.Add(1)
|
||||
go func() {
|
||||
defer b.container.bwg.Done()
|
||||
d.OnShutdown()
|
||||
b.container.bwg.Done()
|
||||
}()
|
||||
}
|
||||
}
|
||||
@@ -416,7 +411,6 @@ func (b *Bar) serve(bs *bState) {
|
||||
bs.aborted = !bs.completed()
|
||||
b.bs = bs
|
||||
close(b.bsOk)
|
||||
b.container.bwg.Done()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
8
vendor/github.com/vbauerster/mpb/v8/bar_filler_bar.go
generated
vendored
8
vendor/github.com/vbauerster/mpb/v8/bar_filler_bar.go
generated
vendored
@@ -175,12 +175,12 @@ func (s barStyle) Build() BarFiller {
|
||||
bytes: []byte(s.style[iPadding]),
|
||||
}
|
||||
bf.tip.onComplete = s.tipOnComplete
|
||||
bf.tip.frames = make([]component, len(s.tipFrames))
|
||||
for i, t := range s.tipFrames {
|
||||
bf.tip.frames[i] = component{
|
||||
bf.tip.frames = make([]component, 0, len(s.tipFrames))
|
||||
for _, t := range s.tipFrames {
|
||||
bf.tip.frames = append(bf.tip.frames, component{
|
||||
width: runewidth.StringWidth(t),
|
||||
bytes: []byte(t),
|
||||
}
|
||||
})
|
||||
}
|
||||
if s.rev {
|
||||
bf.flushOp = barSections.flushRev
|
||||
|
||||
18
vendor/github.com/vbauerster/mpb/v8/priority_queue.go
generated
vendored
18
vendor/github.com/vbauerster/mpb/v8/priority_queue.go
generated
vendored
@@ -21,17 +21,17 @@ func (pq priorityQueue) Swap(i, j int) {
|
||||
|
||||
func (pq *priorityQueue) Push(x interface{}) {
|
||||
s := *pq
|
||||
bar := x.(*Bar)
|
||||
bar.index = len(s)
|
||||
*pq = append(s, bar)
|
||||
b := x.(*Bar)
|
||||
b.index = len(s)
|
||||
*pq = append(s, b)
|
||||
}
|
||||
|
||||
func (pq *priorityQueue) Pop() interface{} {
|
||||
var b *Bar
|
||||
s := *pq
|
||||
l := len(s)
|
||||
bar := s[l-1]
|
||||
bar.index = -1 // for safety
|
||||
s[l-1] = nil // avoid memory leak
|
||||
*pq = s[:l-1]
|
||||
return bar
|
||||
i := len(s) - 1
|
||||
b, s[i] = s[i], nil // nil to avoid memory leak
|
||||
b.index = -1 // for safety
|
||||
*pq = s[:i]
|
||||
return b
|
||||
}
|
||||
|
||||
33
vendor/github.com/vbauerster/mpb/v8/progress.go
generated
vendored
33
vendor/github.com/vbauerster/mpb/v8/progress.go
generated
vendored
@@ -355,16 +355,18 @@ func (s *pState) render(cw *cwriter.Writer) (err error) {
|
||||
height = width
|
||||
}
|
||||
|
||||
var barCount int
|
||||
for b := range iter {
|
||||
barCount++
|
||||
go b.render(width)
|
||||
}
|
||||
|
||||
return s.flush(cw, height, iterPop)
|
||||
return s.flush(cw, height, barCount, iterPop)
|
||||
}
|
||||
|
||||
func (s *pState) flush(cw *cwriter.Writer, height int, iter <-chan *Bar) error {
|
||||
var popCount int
|
||||
var rows []io.Reader
|
||||
func (s *pState) flush(cw *cwriter.Writer, height, barCount int, iter <-chan *Bar) error {
|
||||
var total, popCount int
|
||||
rows := make([][]io.Reader, 0, barCount)
|
||||
|
||||
for b := range iter {
|
||||
frame := <-b.frameCh
|
||||
@@ -373,15 +375,16 @@ func (s *pState) flush(cw *cwriter.Writer, height int, iter <-chan *Bar) error {
|
||||
b.cancel()
|
||||
return frame.err // b.frameCh is buffered it's ok to return here
|
||||
}
|
||||
var usedRows int
|
||||
var discarded int
|
||||
for i := len(frame.rows) - 1; i >= 0; i-- {
|
||||
if row := frame.rows[i]; len(rows) < height {
|
||||
rows = append(rows, row)
|
||||
usedRows++
|
||||
if total < height {
|
||||
total++
|
||||
} else {
|
||||
_, _ = io.Copy(io.Discard, row)
|
||||
_, _ = io.Copy(io.Discard, frame.rows[i]) // Found IsInBounds
|
||||
discarded++
|
||||
}
|
||||
}
|
||||
rows = append(rows, frame.rows)
|
||||
|
||||
switch frame.shutdown {
|
||||
case 1:
|
||||
@@ -399,7 +402,7 @@ func (s *pState) flush(cw *cwriter.Writer, height int, iter <-chan *Bar) error {
|
||||
}
|
||||
case 2:
|
||||
if s.popCompleted && !frame.noPop {
|
||||
popCount += usedRows
|
||||
popCount += len(frame.rows) - discarded
|
||||
continue
|
||||
}
|
||||
fallthrough
|
||||
@@ -409,13 +412,15 @@ func (s *pState) flush(cw *cwriter.Writer, height int, iter <-chan *Bar) error {
|
||||
}
|
||||
|
||||
for i := len(rows) - 1; i >= 0; i-- {
|
||||
_, err := cw.ReadFrom(rows[i])
|
||||
if err != nil {
|
||||
return err
|
||||
for _, r := range rows[i] {
|
||||
_, err := cw.ReadFrom(r)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return cw.Flush(len(rows) - popCount)
|
||||
return cw.Flush(total - popCount)
|
||||
}
|
||||
|
||||
func (s pState) makeBarState(total int64, filler BarFiller, options ...BarOption) *bState {
|
||||
|
||||
Reference in New Issue
Block a user