mirror of
https://github.com/containers/podman.git
synced 2025-11-29 09:37:38 +08:00
Update module github.com/vbauerster/mpb/v8 to v8.11.2
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
19
vendor/github.com/vbauerster/mpb/v8/bar.go
generated
vendored
19
vendor/github.com/vbauerster/mpb/v8/bar.go
generated
vendored
@@ -5,7 +5,6 @@ import (
|
||||
"context"
|
||||
"io"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/acarl005/stripansi"
|
||||
@@ -266,21 +265,14 @@ func (b *Bar) EwmaIncrBy(n int, iterDur time.Duration) {
|
||||
func (b *Bar) EwmaIncrInt64(n int64, iterDur time.Duration) {
|
||||
select {
|
||||
case b.operateState <- func(s *bState) {
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(len(s.ewmaDecorators))
|
||||
for _, d := range s.ewmaDecorators {
|
||||
// d := d // NOTE: uncomment for Go < 1.22, see /doc/faq#closures_and_goroutines
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
d.EwmaUpdate(n, iterDur)
|
||||
}()
|
||||
d.EwmaUpdate(n, iterDur)
|
||||
}
|
||||
s.current += n
|
||||
if s.triggerComplete && s.current >= s.total {
|
||||
s.current = s.total
|
||||
s.triggerCompletion(b)
|
||||
}
|
||||
wg.Wait()
|
||||
}:
|
||||
case <-b.ctx.Done():
|
||||
}
|
||||
@@ -295,21 +287,14 @@ func (b *Bar) EwmaSetCurrent(current int64, iterDur time.Duration) {
|
||||
select {
|
||||
case b.operateState <- func(s *bState) {
|
||||
n := current - s.current
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(len(s.ewmaDecorators))
|
||||
for _, d := range s.ewmaDecorators {
|
||||
// d := d // NOTE: uncomment for Go < 1.22, see /doc/faq#closures_and_goroutines
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
d.EwmaUpdate(n, iterDur)
|
||||
}()
|
||||
d.EwmaUpdate(n, iterDur)
|
||||
}
|
||||
s.current = current
|
||||
if s.triggerComplete && s.current >= s.total {
|
||||
s.current = s.total
|
||||
s.triggerCompletion(b)
|
||||
}
|
||||
wg.Wait()
|
||||
}:
|
||||
case <-b.ctx.Done():
|
||||
}
|
||||
|
||||
15
vendor/github.com/vbauerster/mpb/v8/container_option.go
generated
vendored
15
vendor/github.com/vbauerster/mpb/v8/container_option.go
generated
vendored
@@ -1,6 +1,7 @@
|
||||
package mpb
|
||||
|
||||
import (
|
||||
"cmp"
|
||||
"io"
|
||||
"sync"
|
||||
"time"
|
||||
@@ -32,9 +33,7 @@ func WithWidth(width int) ContainerOption {
|
||||
|
||||
// WithQueueLen sets buffer size of heap manager channel. Ideally it must be
|
||||
// kept at MAX value, where MAX is number of bars to be rendered at the same
|
||||
// time. If len < MAX then backpressure to the scheduler will be increased as
|
||||
// MAX-len extra goroutines will be launched at each render cycle.
|
||||
// Default queue len is 128.
|
||||
// time. Default queue len is 128.
|
||||
func WithQueueLen(len int) ContainerOption {
|
||||
return func(s *pState) {
|
||||
s.hmQueueLen = len
|
||||
@@ -78,21 +77,15 @@ func WithShutdownNotifier(ch chan<- interface{}) ContainerOption {
|
||||
// is not a terminal then auto refresh is disabled unless WithAutoRefresh
|
||||
// option is set.
|
||||
func WithOutput(w io.Writer) ContainerOption {
|
||||
if w == nil {
|
||||
w = io.Discard
|
||||
}
|
||||
return func(s *pState) {
|
||||
s.output = w
|
||||
s.output = cmp.Or(w, io.Discard)
|
||||
}
|
||||
}
|
||||
|
||||
// WithDebugOutput sets debug output.
|
||||
func WithDebugOutput(w io.Writer) ContainerOption {
|
||||
if w == nil {
|
||||
w = io.Discard
|
||||
}
|
||||
return func(s *pState) {
|
||||
s.debugOut = w
|
||||
s.debugOut = cmp.Or(w, io.Discard)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
2
vendor/github.com/vbauerster/mpb/v8/decor/decorator.go
generated
vendored
2
vendor/github.com/vbauerster/mpb/v8/decor/decorator.go
generated
vendored
@@ -165,7 +165,7 @@ func (wc *WC) Init() WC {
|
||||
wc.fill = runewidth.FillLeft
|
||||
}
|
||||
if (wc.C & DSyncWidth) != 0 {
|
||||
// it's deliberate choice to override wsync on each Init() call,
|
||||
// it's deliberate choice to override wc.sync on each Init() call,
|
||||
// this way globals like WCSyncSpace can be reused
|
||||
wc.sync = &Sync{make(chan int, 1), make(chan int, 1)}
|
||||
}
|
||||
|
||||
61
vendor/github.com/vbauerster/mpb/v8/heap_manager.go
generated
vendored
61
vendor/github.com/vbauerster/mpb/v8/heap_manager.go
generated
vendored
@@ -17,7 +17,6 @@ const (
|
||||
h_iter
|
||||
h_fix
|
||||
h_state
|
||||
h_end
|
||||
)
|
||||
|
||||
type heapRequest struct {
|
||||
@@ -38,13 +37,23 @@ type fixData struct {
|
||||
lazy bool
|
||||
}
|
||||
|
||||
func (m heapManager) run() {
|
||||
func (m heapManager) run(shutdownNotifier chan<- interface{}) {
|
||||
var bHeap barHeap
|
||||
var pMatrix map[int][]*decor.Sync
|
||||
var aMatrix map[int][]*decor.Sync
|
||||
done := make(chan struct{})
|
||||
defer func() {
|
||||
close(done)
|
||||
if shutdownNotifier != nil {
|
||||
select {
|
||||
case shutdownNotifier <- []*Bar(bHeap):
|
||||
case <-time.After(time.Second):
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
var sync bool
|
||||
var prevLen int
|
||||
var pMatrix map[int][]*decor.Sync
|
||||
var aMatrix map[int][]*decor.Sync
|
||||
|
||||
for req := range m {
|
||||
switch req.cmd {
|
||||
@@ -63,8 +72,8 @@ func (m heapManager) run() {
|
||||
}
|
||||
sync, prevLen = false, bHeap.Len()
|
||||
}
|
||||
syncWidth(pMatrix)
|
||||
syncWidth(aMatrix)
|
||||
syncWidth(pMatrix, done)
|
||||
syncWidth(aMatrix, done)
|
||||
case h_push:
|
||||
data := req.data.(pushData)
|
||||
heap.Push(&bHeap, data.bar)
|
||||
@@ -92,17 +101,6 @@ func (m heapManager) run() {
|
||||
case h_state:
|
||||
ch := req.data.(chan<- bool)
|
||||
ch <- sync || prevLen != bHeap.Len()
|
||||
case h_end:
|
||||
ch := req.data.(chan<- interface{})
|
||||
if ch != nil {
|
||||
go func() {
|
||||
select {
|
||||
case ch <- []*Bar(bHeap):
|
||||
case <-time.After(time.Second):
|
||||
}
|
||||
}()
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -113,14 +111,7 @@ func (m heapManager) sync() {
|
||||
|
||||
func (m heapManager) push(b *Bar, sync bool) {
|
||||
data := pushData{b, sync}
|
||||
req := heapRequest{cmd: h_push, data: data}
|
||||
select {
|
||||
case m <- req:
|
||||
default:
|
||||
go func() {
|
||||
m <- req
|
||||
}()
|
||||
}
|
||||
m <- heapRequest{cmd: h_push, data: data}
|
||||
}
|
||||
|
||||
func (m heapManager) iter(req ...iterRequest) {
|
||||
@@ -136,22 +127,22 @@ func (m heapManager) state(ch chan<- bool) {
|
||||
m <- heapRequest{cmd: h_state, data: ch}
|
||||
}
|
||||
|
||||
func (m heapManager) end(ch chan<- interface{}) {
|
||||
m <- heapRequest{cmd: h_end, data: ch}
|
||||
}
|
||||
|
||||
func syncWidth(matrix map[int][]*decor.Sync) {
|
||||
func syncWidth(matrix map[int][]*decor.Sync, done <-chan struct{}) {
|
||||
for _, column := range matrix {
|
||||
go maxWidthDistributor(column)
|
||||
go maxWidthDistributor(column, done)
|
||||
}
|
||||
}
|
||||
|
||||
func maxWidthDistributor(column []*decor.Sync) {
|
||||
func maxWidthDistributor(column []*decor.Sync, done <-chan struct{}) {
|
||||
var maxWidth int
|
||||
for _, s := range column {
|
||||
w := <-s.Tx
|
||||
if w > maxWidth {
|
||||
maxWidth = w
|
||||
select {
|
||||
case w := <-s.Tx:
|
||||
if w > maxWidth {
|
||||
maxWidth = w
|
||||
}
|
||||
case <-done:
|
||||
return
|
||||
}
|
||||
}
|
||||
for _, s := range column {
|
||||
|
||||
17
vendor/github.com/vbauerster/mpb/v8/progress.go
generated
vendored
17
vendor/github.com/vbauerster/mpb/v8/progress.go
generated
vendored
@@ -2,6 +2,7 @@ package mpb
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"cmp"
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
@@ -110,8 +111,8 @@ func NewWithContext(ctx context.Context, options ...ContainerOption) *Progress {
|
||||
}
|
||||
|
||||
p.pwg.Add(1)
|
||||
go s.hm.run(s.shutdownNotifier)
|
||||
go p.serve(s, cw)
|
||||
go s.hm.run()
|
||||
return p
|
||||
}
|
||||
|
||||
@@ -243,7 +244,10 @@ func (p *Progress) Shutdown() {
|
||||
}
|
||||
|
||||
func (p *Progress) serve(s *pState, cw *cwriter.Writer) {
|
||||
defer p.pwg.Done()
|
||||
defer func() {
|
||||
close(s.hm)
|
||||
p.pwg.Done()
|
||||
}()
|
||||
var err error
|
||||
var w *cwriter.Writer
|
||||
renderReq := s.renderReq
|
||||
@@ -297,7 +301,6 @@ func (p *Progress) serve(s *pState, cw *cwriter.Writer) {
|
||||
s.hm.state(update)
|
||||
}
|
||||
}
|
||||
s.hm.end(s.shutdownNotifier)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -334,7 +337,7 @@ func (s *pState) manualRefreshListener(done chan struct{}) {
|
||||
}
|
||||
|
||||
func (s *pState) render(cw *cwriter.Writer) (err error) {
|
||||
req := make(iterRequest, 1)
|
||||
req := make(iterRequest, 2)
|
||||
s.hm.sync()
|
||||
s.hm.iter(req, req)
|
||||
|
||||
@@ -345,11 +348,7 @@ func (s *pState) render(cw *cwriter.Writer) (err error) {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if s.reqWidth > 0 {
|
||||
width = s.reqWidth
|
||||
} else {
|
||||
width = 80
|
||||
}
|
||||
width = cmp.Or(s.reqWidth, 80)
|
||||
height = width
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user