mirror of
https://github.com/containers/skopeo.git
synced 2025-09-19 17:15:32 +00:00
Update c/image with https://github.com/containers/image/pull/1944
... to update github.com/opencontainers/image-spec to v1.1.0-rc3. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
4
vendor/github.com/vbauerster/mpb/v8/README.md
generated
vendored
4
vendor/github.com/vbauerster/mpb/v8/README.md
generated
vendored
@@ -82,8 +82,8 @@ func main() {
|
||||
mpb.AppendDecorators(
|
||||
// replace ETA decorator with "done" message, OnComplete event
|
||||
decor.OnComplete(
|
||||
// ETA decorator with ewma age of 60
|
||||
decor.EwmaETA(decor.ET_STYLE_GO, 60, decor.WCSyncWidth), "done",
|
||||
// ETA decorator with ewma age of 30
|
||||
decor.EwmaETA(decor.ET_STYLE_GO, 30, decor.WCSyncWidth), "done",
|
||||
),
|
||||
),
|
||||
)
|
||||
|
188
vendor/github.com/vbauerster/mpb/v8/decor/counters.go
generated
vendored
188
vendor/github.com/vbauerster/mpb/v8/decor/counters.go
generated
vendored
@@ -2,13 +2,6 @@ package decor
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
_ = iota
|
||||
UnitKiB
|
||||
UnitKB
|
||||
)
|
||||
|
||||
// CountersNoUnit is a wrapper around Counters with no unit param.
|
||||
@@ -17,54 +10,60 @@ func CountersNoUnit(pairFmt string, wcc ...WC) Decorator {
|
||||
}
|
||||
|
||||
// CountersKibiByte is a wrapper around Counters with predefined unit
|
||||
// UnitKiB (bytes/1024).
|
||||
// as SizeB1024(0).
|
||||
func CountersKibiByte(pairFmt string, wcc ...WC) Decorator {
|
||||
return Counters(UnitKiB, pairFmt, wcc...)
|
||||
return Counters(SizeB1024(0), pairFmt, wcc...)
|
||||
}
|
||||
|
||||
// CountersKiloByte is a wrapper around Counters with predefined unit
|
||||
// UnitKB (bytes/1000).
|
||||
// as SizeB1000(0).
|
||||
func CountersKiloByte(pairFmt string, wcc ...WC) Decorator {
|
||||
return Counters(UnitKB, pairFmt, wcc...)
|
||||
return Counters(SizeB1000(0), pairFmt, wcc...)
|
||||
}
|
||||
|
||||
// Counters decorator with dynamic unit measure adjustment.
|
||||
//
|
||||
// `unit` one of [0|UnitKiB|UnitKB] zero for no unit
|
||||
// `unit` one of [0|SizeB1024(0)|SizeB1000(0)]
|
||||
//
|
||||
// `pairFmt` printf compatible verbs for current and total pair
|
||||
// `pairFmt` printf compatible verbs for current and total
|
||||
//
|
||||
// `wcc` optional WC config
|
||||
//
|
||||
// pairFmt example if unit=UnitKB:
|
||||
// pairFmt example if unit=SizeB1000(0):
|
||||
//
|
||||
// pairFmt="%.1f / %.1f" output: "1.0MB / 12.0MB"
|
||||
// pairFmt="% .1f / % .1f" output: "1.0 MB / 12.0 MB"
|
||||
// pairFmt="%d / %d" output: "1MB / 12MB"
|
||||
// pairFmt="% d / % d" output: "1 MB / 12 MB"
|
||||
func Counters(unit int, pairFmt string, wcc ...WC) Decorator {
|
||||
producer := func(unit int, pairFmt string) DecorFunc {
|
||||
if pairFmt == "" {
|
||||
pairFmt = "%d / %d"
|
||||
} else if strings.Count(pairFmt, "%") != 2 {
|
||||
panic("expected pairFmt with exactly 2 verbs")
|
||||
}
|
||||
switch unit {
|
||||
case UnitKiB:
|
||||
// pairFmt="%.1f / %.1f" output: "1.0MB / 12.0MB"
|
||||
// pairFmt="% .1f / % .1f" output: "1.0 MB / 12.0 MB"
|
||||
// pairFmt="%f / %f" output: "1.000000MB / 12.000000MB"
|
||||
// pairFmt="% f / % f" output: "1.000000 MB / 12.000000 MB"
|
||||
func Counters(unit interface{}, pairFmt string, wcc ...WC) Decorator {
|
||||
producer := func() DecorFunc {
|
||||
switch unit.(type) {
|
||||
case SizeB1024:
|
||||
if pairFmt == "" {
|
||||
pairFmt = "% d / % d"
|
||||
}
|
||||
return func(s Statistics) string {
|
||||
return fmt.Sprintf(pairFmt, SizeB1024(s.Current), SizeB1024(s.Total))
|
||||
}
|
||||
case UnitKB:
|
||||
case SizeB1000:
|
||||
if pairFmt == "" {
|
||||
pairFmt = "% d / % d"
|
||||
}
|
||||
return func(s Statistics) string {
|
||||
return fmt.Sprintf(pairFmt, SizeB1000(s.Current), SizeB1000(s.Total))
|
||||
}
|
||||
default:
|
||||
if pairFmt == "" {
|
||||
pairFmt = "%d / %d"
|
||||
}
|
||||
return func(s Statistics) string {
|
||||
return fmt.Sprintf(pairFmt, s.Current, s.Total)
|
||||
}
|
||||
}
|
||||
}
|
||||
return Any(producer(unit, pairFmt), wcc...)
|
||||
return Any(producer(), wcc...)
|
||||
}
|
||||
|
||||
// TotalNoUnit is a wrapper around Total with no unit param.
|
||||
@@ -73,55 +72,60 @@ func TotalNoUnit(format string, wcc ...WC) Decorator {
|
||||
}
|
||||
|
||||
// TotalKibiByte is a wrapper around Total with predefined unit
|
||||
// UnitKiB (bytes/1024).
|
||||
// as SizeB1024(0).
|
||||
func TotalKibiByte(format string, wcc ...WC) Decorator {
|
||||
return Total(UnitKiB, format, wcc...)
|
||||
return Total(SizeB1024(0), format, wcc...)
|
||||
}
|
||||
|
||||
// TotalKiloByte is a wrapper around Total with predefined unit
|
||||
// UnitKB (bytes/1000).
|
||||
// as SizeB1000(0).
|
||||
func TotalKiloByte(format string, wcc ...WC) Decorator {
|
||||
return Total(UnitKB, format, wcc...)
|
||||
return Total(SizeB1000(0), format, wcc...)
|
||||
}
|
||||
|
||||
// Total decorator with dynamic unit measure adjustment.
|
||||
//
|
||||
// `unit` one of [0|UnitKiB|UnitKB] zero for no unit
|
||||
// `unit` one of [0|SizeB1024(0)|SizeB1000(0)]
|
||||
//
|
||||
// `format` printf compatible verb for Total
|
||||
//
|
||||
// `wcc` optional WC config
|
||||
//
|
||||
// format example if unit=UnitKiB:
|
||||
// format example if unit=SizeB1024(0):
|
||||
//
|
||||
// format="%.1f" output: "12.0MiB"
|
||||
// format="% .1f" output: "12.0 MiB"
|
||||
// format="%d" output: "12MiB"
|
||||
// format="% d" output: "12 MiB"
|
||||
func Total(unit int, format string, wcc ...WC) Decorator {
|
||||
producer := func(unit int, format string) DecorFunc {
|
||||
if format == "" {
|
||||
format = "%d"
|
||||
} else if strings.Count(format, "%") != 1 {
|
||||
panic("expected format with exactly 1 verb")
|
||||
}
|
||||
|
||||
switch unit {
|
||||
case UnitKiB:
|
||||
// format="%.1f" output: "12.0MiB"
|
||||
// format="% .1f" output: "12.0 MiB"
|
||||
// format="%f" output: "12.000000MiB"
|
||||
// format="% f" output: "12.000000 MiB"
|
||||
func Total(unit interface{}, format string, wcc ...WC) Decorator {
|
||||
producer := func() DecorFunc {
|
||||
switch unit.(type) {
|
||||
case SizeB1024:
|
||||
if format == "" {
|
||||
format = "% d"
|
||||
}
|
||||
return func(s Statistics) string {
|
||||
return fmt.Sprintf(format, SizeB1024(s.Total))
|
||||
}
|
||||
case UnitKB:
|
||||
case SizeB1000:
|
||||
if format == "" {
|
||||
format = "% d"
|
||||
}
|
||||
return func(s Statistics) string {
|
||||
return fmt.Sprintf(format, SizeB1000(s.Total))
|
||||
}
|
||||
default:
|
||||
if format == "" {
|
||||
format = "%d"
|
||||
}
|
||||
return func(s Statistics) string {
|
||||
return fmt.Sprintf(format, s.Total)
|
||||
}
|
||||
}
|
||||
}
|
||||
return Any(producer(unit, format), wcc...)
|
||||
return Any(producer(), wcc...)
|
||||
}
|
||||
|
||||
// CurrentNoUnit is a wrapper around Current with no unit param.
|
||||
@@ -130,55 +134,60 @@ func CurrentNoUnit(format string, wcc ...WC) Decorator {
|
||||
}
|
||||
|
||||
// CurrentKibiByte is a wrapper around Current with predefined unit
|
||||
// UnitKiB (bytes/1024).
|
||||
// as SizeB1024(0).
|
||||
func CurrentKibiByte(format string, wcc ...WC) Decorator {
|
||||
return Current(UnitKiB, format, wcc...)
|
||||
return Current(SizeB1024(0), format, wcc...)
|
||||
}
|
||||
|
||||
// CurrentKiloByte is a wrapper around Current with predefined unit
|
||||
// UnitKB (bytes/1000).
|
||||
// as SizeB1000(0).
|
||||
func CurrentKiloByte(format string, wcc ...WC) Decorator {
|
||||
return Current(UnitKB, format, wcc...)
|
||||
return Current(SizeB1000(0), format, wcc...)
|
||||
}
|
||||
|
||||
// Current decorator with dynamic unit measure adjustment.
|
||||
//
|
||||
// `unit` one of [0|UnitKiB|UnitKB] zero for no unit
|
||||
// `unit` one of [0|SizeB1024(0)|SizeB1000(0)]
|
||||
//
|
||||
// `format` printf compatible verb for Current
|
||||
//
|
||||
// `wcc` optional WC config
|
||||
//
|
||||
// format example if unit=UnitKiB:
|
||||
// format example if unit=SizeB1024(0):
|
||||
//
|
||||
// format="%.1f" output: "12.0MiB"
|
||||
// format="% .1f" output: "12.0 MiB"
|
||||
// format="%d" output: "12MiB"
|
||||
// format="% d" output: "12 MiB"
|
||||
func Current(unit int, format string, wcc ...WC) Decorator {
|
||||
producer := func(unit int, format string) DecorFunc {
|
||||
if format == "" {
|
||||
format = "%d"
|
||||
} else if strings.Count(format, "%") != 1 {
|
||||
panic("expected format with exactly 1 verb")
|
||||
}
|
||||
|
||||
switch unit {
|
||||
case UnitKiB:
|
||||
// format="%.1f" output: "12.0MiB"
|
||||
// format="% .1f" output: "12.0 MiB"
|
||||
// format="%f" output: "12.000000MiB"
|
||||
// format="% f" output: "12.000000 MiB"
|
||||
func Current(unit interface{}, format string, wcc ...WC) Decorator {
|
||||
producer := func() DecorFunc {
|
||||
switch unit.(type) {
|
||||
case SizeB1024:
|
||||
if format == "" {
|
||||
format = "% d"
|
||||
}
|
||||
return func(s Statistics) string {
|
||||
return fmt.Sprintf(format, SizeB1024(s.Current))
|
||||
}
|
||||
case UnitKB:
|
||||
case SizeB1000:
|
||||
if format == "" {
|
||||
format = "% d"
|
||||
}
|
||||
return func(s Statistics) string {
|
||||
return fmt.Sprintf(format, SizeB1000(s.Current))
|
||||
}
|
||||
default:
|
||||
if format == "" {
|
||||
format = "%d"
|
||||
}
|
||||
return func(s Statistics) string {
|
||||
return fmt.Sprintf(format, s.Current)
|
||||
}
|
||||
}
|
||||
}
|
||||
return Any(producer(unit, format), wcc...)
|
||||
return Any(producer(), wcc...)
|
||||
}
|
||||
|
||||
// InvertedCurrentNoUnit is a wrapper around InvertedCurrent with no unit param.
|
||||
@@ -187,53 +196,58 @@ func InvertedCurrentNoUnit(format string, wcc ...WC) Decorator {
|
||||
}
|
||||
|
||||
// InvertedCurrentKibiByte is a wrapper around InvertedCurrent with predefined unit
|
||||
// UnitKiB (bytes/1024).
|
||||
// as SizeB1024(0).
|
||||
func InvertedCurrentKibiByte(format string, wcc ...WC) Decorator {
|
||||
return InvertedCurrent(UnitKiB, format, wcc...)
|
||||
return InvertedCurrent(SizeB1024(0), format, wcc...)
|
||||
}
|
||||
|
||||
// InvertedCurrentKiloByte is a wrapper around InvertedCurrent with predefined unit
|
||||
// UnitKB (bytes/1000).
|
||||
// as SizeB1000(0).
|
||||
func InvertedCurrentKiloByte(format string, wcc ...WC) Decorator {
|
||||
return InvertedCurrent(UnitKB, format, wcc...)
|
||||
return InvertedCurrent(SizeB1000(0), format, wcc...)
|
||||
}
|
||||
|
||||
// InvertedCurrent decorator with dynamic unit measure adjustment.
|
||||
//
|
||||
// `unit` one of [0|UnitKiB|UnitKB] zero for no unit
|
||||
// `unit` one of [0|SizeB1024(0)|SizeB1000(0)]
|
||||
//
|
||||
// `format` printf compatible verb for InvertedCurrent
|
||||
//
|
||||
// `wcc` optional WC config
|
||||
//
|
||||
// format example if unit=UnitKiB:
|
||||
// format example if unit=SizeB1024(0):
|
||||
//
|
||||
// format="%.1f" output: "12.0MiB"
|
||||
// format="% .1f" output: "12.0 MiB"
|
||||
// format="%d" output: "12MiB"
|
||||
// format="% d" output: "12 MiB"
|
||||
func InvertedCurrent(unit int, format string, wcc ...WC) Decorator {
|
||||
producer := func(unit int, format string) DecorFunc {
|
||||
if format == "" {
|
||||
format = "%d"
|
||||
} else if strings.Count(format, "%") != 1 {
|
||||
panic("expected format with exactly 1 verb")
|
||||
}
|
||||
|
||||
switch unit {
|
||||
case UnitKiB:
|
||||
// format="%.1f" output: "12.0MiB"
|
||||
// format="% .1f" output: "12.0 MiB"
|
||||
// format="%f" output: "12.000000MiB"
|
||||
// format="% f" output: "12.000000 MiB"
|
||||
func InvertedCurrent(unit interface{}, format string, wcc ...WC) Decorator {
|
||||
producer := func() DecorFunc {
|
||||
switch unit.(type) {
|
||||
case SizeB1024:
|
||||
if format == "" {
|
||||
format = "% d"
|
||||
}
|
||||
return func(s Statistics) string {
|
||||
return fmt.Sprintf(format, SizeB1024(s.Total-s.Current))
|
||||
}
|
||||
case UnitKB:
|
||||
case SizeB1000:
|
||||
if format == "" {
|
||||
format = "% d"
|
||||
}
|
||||
return func(s Statistics) string {
|
||||
return fmt.Sprintf(format, SizeB1000(s.Total-s.Current))
|
||||
}
|
||||
default:
|
||||
if format == "" {
|
||||
format = "%d"
|
||||
}
|
||||
return func(s Statistics) string {
|
||||
return fmt.Sprintf(format, s.Total-s.Current)
|
||||
}
|
||||
}
|
||||
}
|
||||
return Any(producer(unit, format), wcc...)
|
||||
return Any(producer(), wcc...)
|
||||
}
|
||||
|
3
vendor/github.com/vbauerster/mpb/v8/decor/eta.go
generated
vendored
3
vendor/github.com/vbauerster/mpb/v8/decor/eta.go
generated
vendored
@@ -199,8 +199,7 @@ func chooseTimeProducer(style TimeStyle) func(time.Duration) string {
|
||||
}
|
||||
default:
|
||||
return func(remaining time.Duration) string {
|
||||
// strip off nanoseconds
|
||||
return ((remaining / time.Second) * time.Second).String()
|
||||
return remaining.Truncate(time.Second).String()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
3
vendor/github.com/vbauerster/mpb/v8/decor/on_abort.go
generated
vendored
3
vendor/github.com/vbauerster/mpb/v8/decor/on_abort.go
generated
vendored
@@ -34,8 +34,7 @@ type onAbortWrapper struct {
|
||||
|
||||
func (d *onAbortWrapper) Decor(s Statistics) string {
|
||||
if s.Aborted {
|
||||
wc := d.GetConf()
|
||||
return wc.FormatMsg(d.msg)
|
||||
return d.GetConf().FormatMsg(d.msg)
|
||||
}
|
||||
return d.Decorator.Decor(s)
|
||||
}
|
||||
|
3
vendor/github.com/vbauerster/mpb/v8/decor/on_complete.go
generated
vendored
3
vendor/github.com/vbauerster/mpb/v8/decor/on_complete.go
generated
vendored
@@ -33,8 +33,7 @@ type onCompleteWrapper struct {
|
||||
|
||||
func (d *onCompleteWrapper) Decor(s Statistics) string {
|
||||
if s.Completed {
|
||||
wc := d.GetConf()
|
||||
return wc.FormatMsg(d.msg)
|
||||
return d.GetConf().FormatMsg(d.msg)
|
||||
}
|
||||
return d.Decorator.Decor(s)
|
||||
}
|
||||
|
30
vendor/github.com/vbauerster/mpb/v8/decor/percentage.go
generated
vendored
30
vendor/github.com/vbauerster/mpb/v8/decor/percentage.go
generated
vendored
@@ -7,24 +7,25 @@ import (
|
||||
"github.com/vbauerster/mpb/v8/internal"
|
||||
)
|
||||
|
||||
var _ fmt.Formatter = percentageType(0)
|
||||
|
||||
type percentageType float64
|
||||
|
||||
func (s percentageType) Format(st fmt.State, verb rune) {
|
||||
var prec int
|
||||
prec := -1
|
||||
switch verb {
|
||||
case 'd':
|
||||
case 's':
|
||||
prec = -1
|
||||
default:
|
||||
case 'f', 'e', 'E':
|
||||
prec = 6 // default prec of fmt.Printf("%f|%e|%E")
|
||||
fallthrough
|
||||
case 'b', 'g', 'G', 'x', 'X':
|
||||
if p, ok := st.Precision(); ok {
|
||||
prec = p
|
||||
} else {
|
||||
prec = 6
|
||||
}
|
||||
default:
|
||||
verb, prec = 'f', 0
|
||||
}
|
||||
|
||||
p := bytesPool.Get().(*[]byte)
|
||||
b := strconv.AppendFloat(*p, float64(s), 'f', prec, 64)
|
||||
b := strconv.AppendFloat(make([]byte, 0, 16), float64(s), byte(verb), prec, 64)
|
||||
if st.Flag(' ') {
|
||||
b = append(b, ' ', '%')
|
||||
} else {
|
||||
@@ -34,7 +35,6 @@ func (s percentageType) Format(st fmt.State, verb rune) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
bytesPool.Put(p)
|
||||
}
|
||||
|
||||
// Percentage returns percentage decorator. It's a wrapper of NewPercentage.
|
||||
@@ -44,12 +44,18 @@ func Percentage(wcc ...WC) Decorator {
|
||||
|
||||
// NewPercentage percentage decorator with custom format string.
|
||||
//
|
||||
// `format` printf compatible verb
|
||||
//
|
||||
// `wcc` optional WC config
|
||||
//
|
||||
// format examples:
|
||||
//
|
||||
// format="%.1f" output: "1.0%"
|
||||
// format="% .1f" output: "1.0 %"
|
||||
// format="%d" output: "1%"
|
||||
// format="% d" output: "1 %"
|
||||
// format="%.1f" output: "1.0%"
|
||||
// format="% .1f" output: "1.0 %"
|
||||
// format="%f" output: "1.000000%"
|
||||
// format="% f" output: "1.000000 %"
|
||||
func NewPercentage(format string, wcc ...WC) Decorator {
|
||||
if format == "" {
|
||||
format = "% d"
|
||||
|
10
vendor/github.com/vbauerster/mpb/v8/decor/pool.go
generated
vendored
10
vendor/github.com/vbauerster/mpb/v8/decor/pool.go
generated
vendored
@@ -1,10 +0,0 @@
|
||||
package decor
|
||||
|
||||
import "sync"
|
||||
|
||||
var bytesPool = sync.Pool{
|
||||
New: func() interface{} {
|
||||
b := make([]byte, 0, 32)
|
||||
return &b
|
||||
},
|
||||
}
|
43
vendor/github.com/vbauerster/mpb/v8/decor/size_type.go
generated
vendored
43
vendor/github.com/vbauerster/mpb/v8/decor/size_type.go
generated
vendored
@@ -8,6 +8,13 @@ import (
|
||||
//go:generate stringer -type=SizeB1024 -trimprefix=_i
|
||||
//go:generate stringer -type=SizeB1000 -trimprefix=_
|
||||
|
||||
var (
|
||||
_ fmt.Formatter = SizeB1024(0)
|
||||
_ fmt.Stringer = SizeB1024(0)
|
||||
_ fmt.Formatter = SizeB1000(0)
|
||||
_ fmt.Stringer = SizeB1000(0)
|
||||
)
|
||||
|
||||
const (
|
||||
_ib SizeB1024 = iota + 1
|
||||
_iKiB SizeB1024 = 1 << (iota * 10)
|
||||
@@ -22,17 +29,17 @@ const (
|
||||
type SizeB1024 int64
|
||||
|
||||
func (self SizeB1024) Format(st fmt.State, verb rune) {
|
||||
var prec int
|
||||
prec := -1
|
||||
switch verb {
|
||||
case 'd':
|
||||
case 's':
|
||||
prec = -1
|
||||
default:
|
||||
case 'f', 'e', 'E':
|
||||
prec = 6 // default prec of fmt.Printf("%f|%e|%E")
|
||||
fallthrough
|
||||
case 'b', 'g', 'G', 'x', 'X':
|
||||
if p, ok := st.Precision(); ok {
|
||||
prec = p
|
||||
} else {
|
||||
prec = 6
|
||||
}
|
||||
default:
|
||||
verb, prec = 'f', 0
|
||||
}
|
||||
|
||||
var unit SizeB1024
|
||||
@@ -49,8 +56,7 @@ func (self SizeB1024) Format(st fmt.State, verb rune) {
|
||||
unit = _iTiB
|
||||
}
|
||||
|
||||
p := bytesPool.Get().(*[]byte)
|
||||
b := strconv.AppendFloat(*p, float64(self)/float64(unit), 'f', prec, 64)
|
||||
b := strconv.AppendFloat(make([]byte, 0, 24), float64(self)/float64(unit), byte(verb), prec, 64)
|
||||
if st.Flag(' ') {
|
||||
b = append(b, ' ')
|
||||
}
|
||||
@@ -59,7 +65,6 @@ func (self SizeB1024) Format(st fmt.State, verb rune) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
bytesPool.Put(p)
|
||||
}
|
||||
|
||||
const (
|
||||
@@ -76,17 +81,17 @@ const (
|
||||
type SizeB1000 int64
|
||||
|
||||
func (self SizeB1000) Format(st fmt.State, verb rune) {
|
||||
var prec int
|
||||
prec := -1
|
||||
switch verb {
|
||||
case 'd':
|
||||
case 's':
|
||||
prec = -1
|
||||
default:
|
||||
case 'f', 'e', 'E':
|
||||
prec = 6 // default prec of fmt.Printf("%f|%e|%E")
|
||||
fallthrough
|
||||
case 'b', 'g', 'G', 'x', 'X':
|
||||
if p, ok := st.Precision(); ok {
|
||||
prec = p
|
||||
} else {
|
||||
prec = 6
|
||||
}
|
||||
default:
|
||||
verb, prec = 'f', 0
|
||||
}
|
||||
|
||||
var unit SizeB1000
|
||||
@@ -103,8 +108,7 @@ func (self SizeB1000) Format(st fmt.State, verb rune) {
|
||||
unit = _TB
|
||||
}
|
||||
|
||||
p := bytesPool.Get().(*[]byte)
|
||||
b := strconv.AppendFloat(*p, float64(self)/float64(unit), 'f', prec, 64)
|
||||
b := strconv.AppendFloat(make([]byte, 0, 24), float64(self)/float64(unit), byte(verb), prec, 64)
|
||||
if st.Flag(' ') {
|
||||
b = append(b, ' ')
|
||||
}
|
||||
@@ -113,5 +117,4 @@ func (self SizeB1000) Format(st fmt.State, verb rune) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
bytesPool.Put(p)
|
||||
}
|
||||
|
52
vendor/github.com/vbauerster/mpb/v8/decor/speed.go
generated
vendored
52
vendor/github.com/vbauerster/mpb/v8/decor/speed.go
generated
vendored
@@ -39,7 +39,7 @@ func (self speedFormatter) Format(st fmt.State, verb rune) {
|
||||
// EwmaSpeed exponential-weighted-moving-average based speed decorator.
|
||||
// For this decorator to work correctly you have to measure each iteration's
|
||||
// duration and pass it to one of the (*Bar).EwmaIncr... family methods.
|
||||
func EwmaSpeed(unit int, format string, age float64, wcc ...WC) Decorator {
|
||||
func EwmaSpeed(unit interface{}, format string, age float64, wcc ...WC) Decorator {
|
||||
var average ewma.MovingAverage
|
||||
if age == 0 {
|
||||
average = ewma.NewMovingAverage()
|
||||
@@ -52,7 +52,7 @@ func EwmaSpeed(unit int, format string, age float64, wcc ...WC) Decorator {
|
||||
// MovingAverageSpeed decorator relies on MovingAverage implementation
|
||||
// to calculate its average.
|
||||
//
|
||||
// `unit` one of [0|UnitKiB|UnitKB] zero for no unit
|
||||
// `unit` one of [0|SizeB1024(0)|SizeB1000(0)]
|
||||
//
|
||||
// `format` printf compatible verb for value, like "%f" or "%d"
|
||||
//
|
||||
@@ -62,14 +62,11 @@ func EwmaSpeed(unit int, format string, age float64, wcc ...WC) Decorator {
|
||||
//
|
||||
// format examples:
|
||||
//
|
||||
// unit=UnitKiB, format="%.1f" output: "1.0MiB/s"
|
||||
// unit=UnitKiB, format="% .1f" output: "1.0 MiB/s"
|
||||
// unit=UnitKB, format="%.1f" output: "1.0MB/s"
|
||||
// unit=UnitKB, format="% .1f" output: "1.0 MB/s"
|
||||
func MovingAverageSpeed(unit int, format string, average ewma.MovingAverage, wcc ...WC) Decorator {
|
||||
if format == "" {
|
||||
format = "%.0f"
|
||||
}
|
||||
// unit=SizeB1024(0), format="%.1f" output: "1.0MiB/s"
|
||||
// unit=SizeB1024(0), format="% .1f" output: "1.0 MiB/s"
|
||||
// unit=SizeB1000(0), format="%.1f" output: "1.0MB/s"
|
||||
// unit=SizeB1000(0), format="% .1f" output: "1.0 MB/s"
|
||||
func MovingAverageSpeed(unit interface{}, format string, average ewma.MovingAverage, wcc ...WC) Decorator {
|
||||
d := &movingAverageSpeed{
|
||||
WC: initWC(wcc...),
|
||||
average: average,
|
||||
@@ -106,14 +103,14 @@ func (d *movingAverageSpeed) EwmaUpdate(n int64, dur time.Duration) {
|
||||
|
||||
// AverageSpeed decorator with dynamic unit measure adjustment. It's
|
||||
// a wrapper of NewAverageSpeed.
|
||||
func AverageSpeed(unit int, format string, wcc ...WC) Decorator {
|
||||
func AverageSpeed(unit interface{}, format string, wcc ...WC) Decorator {
|
||||
return NewAverageSpeed(unit, format, time.Now(), wcc...)
|
||||
}
|
||||
|
||||
// NewAverageSpeed decorator with dynamic unit measure adjustment and
|
||||
// user provided start time.
|
||||
//
|
||||
// `unit` one of [0|UnitKiB|UnitKB] zero for no unit
|
||||
// `unit` one of [0|SizeB1024(0)|SizeB1000(0)]
|
||||
//
|
||||
// `format` printf compatible verb for value, like "%f" or "%d"
|
||||
//
|
||||
@@ -123,14 +120,11 @@ func AverageSpeed(unit int, format string, wcc ...WC) Decorator {
|
||||
//
|
||||
// format examples:
|
||||
//
|
||||
// unit=UnitKiB, format="%.1f" output: "1.0MiB/s"
|
||||
// unit=UnitKiB, format="% .1f" output: "1.0 MiB/s"
|
||||
// unit=UnitKB, format="%.1f" output: "1.0MB/s"
|
||||
// unit=UnitKB, format="% .1f" output: "1.0 MB/s"
|
||||
func NewAverageSpeed(unit int, format string, startTime time.Time, wcc ...WC) Decorator {
|
||||
if format == "" {
|
||||
format = "%.0f"
|
||||
}
|
||||
// unit=SizeB1024(0), format="%.1f" output: "1.0MiB/s"
|
||||
// unit=SizeB1024(0), format="% .1f" output: "1.0 MiB/s"
|
||||
// unit=SizeB1000(0), format="%.1f" output: "1.0MB/s"
|
||||
// unit=SizeB1000(0), format="% .1f" output: "1.0 MB/s"
|
||||
func NewAverageSpeed(unit interface{}, format string, startTime time.Time, wcc ...WC) Decorator {
|
||||
d := &averageSpeed{
|
||||
WC: initWC(wcc...),
|
||||
startTime: startTime,
|
||||
@@ -151,7 +145,6 @@ func (d *averageSpeed) Decor(s Statistics) string {
|
||||
speed := float64(s.Current) / float64(time.Since(d.startTime))
|
||||
d.msg = d.producer(speed * 1e9)
|
||||
}
|
||||
|
||||
return d.FormatMsg(d.msg)
|
||||
}
|
||||
|
||||
@@ -159,17 +152,26 @@ func (d *averageSpeed) AverageAdjust(startTime time.Time) {
|
||||
d.startTime = startTime
|
||||
}
|
||||
|
||||
func chooseSpeedProducer(unit int, format string) func(float64) string {
|
||||
switch unit {
|
||||
case UnitKiB:
|
||||
func chooseSpeedProducer(unit interface{}, format string) func(float64) string {
|
||||
switch unit.(type) {
|
||||
case SizeB1024:
|
||||
if format == "" {
|
||||
format = "% d"
|
||||
}
|
||||
return func(speed float64) string {
|
||||
return fmt.Sprintf(format, FmtAsSpeed(SizeB1024(math.Round(speed))))
|
||||
}
|
||||
case UnitKB:
|
||||
case SizeB1000:
|
||||
if format == "" {
|
||||
format = "% d"
|
||||
}
|
||||
return func(speed float64) string {
|
||||
return fmt.Sprintf(format, FmtAsSpeed(SizeB1000(math.Round(speed))))
|
||||
}
|
||||
default:
|
||||
if format == "" {
|
||||
format = "%f"
|
||||
}
|
||||
return func(speed float64) string {
|
||||
return fmt.Sprintf(format, speed)
|
||||
}
|
||||
|
7
vendor/github.com/vbauerster/mpb/v8/heap_manager.go
generated
vendored
7
vendor/github.com/vbauerster/mpb/v8/heap_manager.go
generated
vendored
@@ -46,6 +46,7 @@ func (m heapManager) run() {
|
||||
var sync bool
|
||||
|
||||
for req := range m {
|
||||
next:
|
||||
switch req.cmd {
|
||||
case h_push:
|
||||
data := req.data.(pushData)
|
||||
@@ -78,7 +79,8 @@ func (m heapManager) run() {
|
||||
select {
|
||||
case data.iter <- b:
|
||||
case <-data.drop:
|
||||
break
|
||||
close(data.iter)
|
||||
break next
|
||||
}
|
||||
}
|
||||
close(data.iter)
|
||||
@@ -88,7 +90,8 @@ func (m heapManager) run() {
|
||||
select {
|
||||
case data.iter <- heap.Pop(&bHeap).(*Bar):
|
||||
case <-data.drop:
|
||||
break
|
||||
close(data.iter)
|
||||
break next
|
||||
}
|
||||
}
|
||||
close(data.iter)
|
||||
|
4
vendor/github.com/vbauerster/mpb/v8/progress.go
generated
vendored
4
vendor/github.com/vbauerster/mpb/v8/progress.go
generated
vendored
@@ -19,7 +19,7 @@ const (
|
||||
)
|
||||
|
||||
// DoneError represents an error when `*mpb.Progress` is done but its functionality is requested.
|
||||
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 it's done", (*Progress)(nil))
|
||||
|
||||
// Progress represents a container that renders one or more progress bars.
|
||||
type Progress struct {
|
||||
@@ -351,7 +351,7 @@ func (s *pState) render(cw *cwriter.Writer) (err error) {
|
||||
}
|
||||
|
||||
func (s *pState) flush(cw *cwriter.Writer, height int) error {
|
||||
wg := new(sync.WaitGroup)
|
||||
var wg sync.WaitGroup
|
||||
defer wg.Wait() // waiting for all s.hm.push to complete
|
||||
|
||||
var popCount int
|
||||
|
Reference in New Issue
Block a user