progress

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bar

type Bar struct {
	// contains filtered or unexported fields
}

func (*Bar) Add

func (b *Bar) Add(value int)

Add adding given int value to bar value

func (*Bar) AddTotal

func (b *Bar) AddTotal(n int)

AddTotal adds to the total bar value

func (*Bar) Finish

func (b *Bar) Finish()

Finish stops the bar

func (*Bar) Increment

func (b *Bar) Increment()

Increment atomically increments the progress

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

Pool coordinates progress bars and log output sharing the same terminal.

cheggaaa/pb's own Pool redraws bars on its own ticker goroutine, which races with anything else writing to the terminal (like our logger) and corrupts the display. ipfs/kubo avoids that by funnelling both the bar and its other output through a single sequenced writer that clears the bar line before printing and redraws it after; Pool does the same thing here, generalised to any number of bars, with its own ticker driving the redraw rate so bar updates from many goroutines don't each trigger a terminal write.

func NewPool

func NewPool(environment env.Environment) *Pool

NewPool initialises a pool. Bars are only drawn outside of production.

func (*Pool) NewBar

func (p *Pool) NewBar(name string) *Bar

NewBar creates and registers a new bar with a prefix.

func (*Pool) Stop

func (p *Pool) Stop() error

Stop clears any remaining bars from the terminal.

func (*Pool) Write

func (p *Pool) Write(b []byte) (int, error)

Write implements io.Writer so the logger can route through the pool: the bars are cleared, the log line is printed above them, then they're redrawn.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL