Merge pull request #19774 from containers/renovate/github.com-vbauerster-mpb-v8-8.x

Update module github.com/vbauerster/mpb/v8 to v8.6.0
This commit is contained in:
OpenShift Merge Robot 2023-08-28 19:40:42 +02:00 committed by GitHub
commit 341fb14e77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 63 additions and 33 deletions

4
go.mod
View File

@ -59,7 +59,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.5.2 github.com/vbauerster/mpb/v8 v8.6.0
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-20230801115018-d63ba01acd4b golang.org/x/exp v0.0.0-20230801115018-d63ba01acd4b
@ -143,7 +143,7 @@ require (
github.com/mailru/easyjson v0.7.7 // indirect github.com/mailru/easyjson v0.7.7 // indirect
github.com/manifoldco/promptui v0.9.0 // indirect github.com/manifoldco/promptui v0.9.0 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/miekg/pkcs11 v1.1.1 // indirect github.com/miekg/pkcs11 v1.1.1 // indirect
github.com/mistifyio/go-zfs/v3 v3.0.1 // indirect github.com/mistifyio/go-zfs/v3 v3.0.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect

8
go.sum
View File

@ -714,8 +714,8 @@ github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNx
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o=
github.com/mattn/go-shellwords v1.0.6/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= github.com/mattn/go-shellwords v1.0.6/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o=
github.com/mattn/go-shellwords v1.0.12 h1:M2zGm7EW6UQJvDeQxo4T51eKPurbeFbe8WtebGE2xrk= github.com/mattn/go-shellwords v1.0.12 h1:M2zGm7EW6UQJvDeQxo4T51eKPurbeFbe8WtebGE2xrk=
@ -1008,8 +1008,8 @@ github.com/urfave/cli v1.22.9/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtX
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.5.2 h1:zanzt1cZpSEG5uGNYKcv43+97f0IgEnXpuBFaMxKbM0= github.com/vbauerster/mpb/v8 v8.6.0 h1:b3GbUHKi9VmU587SxEqvYH1QAQEr9XYBiHGaQFsEQME=
github.com/vbauerster/mpb/v8 v8.5.2/go.mod h1:YqKyR4ZR6Gd34yD3cDHPMmQxc+uUQMwjgO/LkxiJQ6I= github.com/vbauerster/mpb/v8 v8.6.0/go.mod h1:S0tuIjikxlLxCeNijNhwAuD/BB3UE/d2nygG8SOldk0=
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=

15
vendor/github.com/vbauerster/mpb/v8/CONTRIBUTING generated vendored Normal file
View File

@ -0,0 +1,15 @@
When contributing your first changes, please include an empty commit for
copyright waiver using the following message (replace 'John Doe' with
your name or nickname):
John Doe Copyright Waiver
I dedicate any and all copyright interest in this software to the
public domain. I make this dedication for the benefit of the public at
large and to the detriment of my heirs and successors. I intend this
dedication to be an overt act of relinquishment in perpetuity of all
present and future rights to this software under copyright law.
The command to create an empty commit from the command-line is:
git commit --allow-empty

View File

@ -338,7 +338,7 @@ func (b *Bar) DecoratorAverageAdjust(start time.Time) {
// priority, i.e. bar will be on top. If you don't need to set priority // priority, i.e. bar will be on top. If you don't need to set priority
// dynamically, better use BarPriority option. // dynamically, better use BarPriority option.
func (b *Bar) SetPriority(priority int) { func (b *Bar) SetPriority(priority int) {
b.container.UpdateBarPriority(b, priority) b.container.UpdateBarPriority(b, priority, false)
} }
// Abort interrupts bar's running goroutine. Abort won't be engaged // Abort interrupts bar's running goroutine. Abort won't be engaged

View File

@ -0,0 +1,10 @@
package decor
// OnCompleteOrOnAbort wrap decorator.
// Displays provided message on complete or on abort event.
//
// `decorator` Decorator to wrap
// `message` message to display
func OnCompleteOrOnAbort(decorator Decorator, message string) Decorator {
return OnComplete(OnAbort(decorator, message), message)
}

View File

@ -1,8 +1,6 @@
package mpb package mpb
import ( import "container/heap"
"container/heap"
)
type heapManager chan heapRequest type heapManager chan heapRequest
@ -36,6 +34,7 @@ type pushData struct {
type fixData struct { type fixData struct {
bar *Bar bar *Bar
priority int priority int
lazy bool
} }
func (m heapManager) run() { func (m heapManager) run() {
@ -46,7 +45,6 @@ func (m heapManager) run() {
var sync bool var sync bool
for req := range m { for req := range m {
next:
switch req.cmd { switch req.cmd {
case h_push: case h_push:
data := req.data.(pushData) data := req.data.(pushData)
@ -75,34 +73,35 @@ func (m heapManager) run() {
syncWidth(aMatrix, drop) syncWidth(aMatrix, drop)
case h_iter: case h_iter:
data := req.data.(iterData) data := req.data.(iterData)
drop_iter:
for _, b := range bHeap { for _, b := range bHeap {
select { select {
case data.iter <- b: case data.iter <- b:
case <-data.drop: case <-data.drop:
close(data.iter) break drop_iter
break next
} }
} }
close(data.iter) close(data.iter)
case h_drain: case h_drain:
data := req.data.(iterData) data := req.data.(iterData)
drop_drain:
for bHeap.Len() != 0 { for bHeap.Len() != 0 {
select { select {
case data.iter <- heap.Pop(&bHeap).(*Bar): case data.iter <- heap.Pop(&bHeap).(*Bar):
case <-data.drop: case <-data.drop:
close(data.iter) break drop_drain
break next
} }
} }
close(data.iter) close(data.iter)
case h_fix: case h_fix:
data := req.data.(fixData) data := req.data.(fixData)
bar, priority := data.bar, data.priority if data.bar.index < 0 {
if bar.index < 0 {
break break
} }
bar.priority = priority data.bar.priority = data.priority
heap.Fix(&bHeap, bar.index) if !data.lazy {
heap.Fix(&bHeap, data.bar.index)
}
case h_state: case h_state:
ch := req.data.(chan<- bool) ch := req.data.(chan<- bool)
ch <- sync || l != bHeap.Len() ch <- sync || l != bHeap.Len()
@ -137,8 +136,8 @@ func (m heapManager) drain(iter chan<- *Bar, drop <-chan struct{}) {
m <- heapRequest{cmd: h_drain, data: data} m <- heapRequest{cmd: h_drain, data: data}
} }
func (m heapManager) fix(b *Bar, priority int) { func (m heapManager) fix(b *Bar, priority int, lazy bool) {
data := fixData{b, priority} data := fixData{b, priority, lazy}
m <- heapRequest{cmd: h_fix, data: data} m <- heapRequest{cmd: h_fix, data: data}
} }

View File

@ -20,17 +20,18 @@ func (pq priorityQueue) Swap(i, j int) {
} }
func (pq *priorityQueue) Push(x interface{}) { func (pq *priorityQueue) Push(x interface{}) {
s := *pq n := len(*pq)
bar := x.(*Bar) bar := x.(*Bar)
bar.index = len(s) bar.index = n
s = append(s, bar) *pq = append(*pq, bar)
*pq = s
} }
func (pq *priorityQueue) Pop() interface{} { func (pq *priorityQueue) Pop() interface{} {
s := *pq old := *pq
*pq = s[0 : len(s)-1] n := len(old)
bar := s[len(s)-1] bar := old[n-1]
old[n-1] = nil // avoid memory leak
bar.index = -1 // for safety bar.index = -1 // for safety
*pq = old[:n-1]
return bar return bar
} }

View File

@ -201,10 +201,15 @@ func (p *Progress) traverseBars(cb func(b *Bar) bool) {
} }
} }
// UpdateBarPriority same as *Bar.SetPriority(int). // UpdateBarPriority either immediately or lazy.
func (p *Progress) UpdateBarPriority(b *Bar, priority int) { // With lazy flag order is updated after the next refresh cycle.
// If you don't care about laziness just use *Bar.SetPriority(int).
func (p *Progress) UpdateBarPriority(b *Bar, priority int, lazy bool) {
if b == nil {
return
}
select { select {
case p.operateState <- func(s *pState) { s.hm.fix(b, priority) }: case p.operateState <- func(s *pState) { s.hm.fix(b, priority, lazy) }:
case <-p.done: case <-p.done:
} }
} }

4
vendor/modules.txt vendored
View File

@ -705,7 +705,7 @@ github.com/manifoldco/promptui/screenbuf
# github.com/mattn/go-isatty v0.0.19 # github.com/mattn/go-isatty v0.0.19
## explicit; go 1.15 ## explicit; go 1.15
github.com/mattn/go-isatty github.com/mattn/go-isatty
# github.com/mattn/go-runewidth v0.0.14 # github.com/mattn/go-runewidth v0.0.15
## explicit; go 1.9 ## explicit; go 1.9
github.com/mattn/go-runewidth github.com/mattn/go-runewidth
# github.com/mattn/go-shellwords v1.0.12 # github.com/mattn/go-shellwords v1.0.12
@ -975,7 +975,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.5.2 # github.com/vbauerster/mpb/v8 v8.6.0
## 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