2020-07-11 22:57:44 +02:00
|
|
|
package progress
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/vbauerster/mpb/v5"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Represents a single progress bar
|
|
|
|
|
type Bar struct {
|
|
|
|
|
bar *mpb.Bar
|
|
|
|
|
total int64
|
|
|
|
|
initialTotal int64
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Drops the specified number of requests from the progress bar total.
|
|
|
|
|
// This may be the case when uncompleted requests are encountered and shouldn't be part of the total count.
|
2020-07-24 22:30:15 +02:00
|
|
|
func (b *Bar) drop(count int64) {
|
2020-07-25 00:46:18 +02:00
|
|
|
b.bar.IncrInt64(count)
|
2020-07-11 22:57:44 +02:00
|
|
|
}
|
2020-07-24 22:30:15 +02:00
|
|
|
|
|
|
|
|
// Update progress tracking information and increments the request counter by one unit.
|
|
|
|
|
func (b *Bar) increment() {
|
|
|
|
|
b.bar.Increment()
|
2020-07-25 00:46:18 +02:00
|
|
|
}
|