Documentation
¶
Overview ¶
Package batch renders progress for concurrent operations. Scheduling belongs to callers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AlignProgress ¶
AlignProgress right-aligns real byte progress, omitting it when the label needs the width.
Types ¶
type Event ¶
type Event struct {
// Warning is a permanent diagnostic and does not count as a job.
Warning string
// Reset starts a new phase, clearing counts and active jobs.
Reset bool
ID int
Count int
Label string
// Version is displayed as a muted parenthesized suffix after the label.
Version string
Phase string
Downloaded, Total int64
// Fraction is caller-defined job progress in [0, 1], independent of completion.
// The renderer retains the highest value across transitions and retries.
Fraction float64
// Bytes marks coalescible byte-only updates. Terminal events are never dropped.
Bytes bool
Done bool
Outcome string
Err error
Attempt int
}
Event describes a job's current state. IDs, unlike labels, must be unique within a run.
type Observer ¶
type Observer func(Event)
Observer receives events serially from Run, even when producers are concurrent.
type Option ¶
type Option func(*Renderer)
Option customizes the renderer without coupling it to job scheduling.
func WithToolchainStyle ¶
func WithToolchainStyle() Option
WithToolchainStyle preserves the toolchain running-count footer.
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer owns an inline region. All methods must be called by its owner goroutine.
func (*Renderer) Clear ¶
func (r *Renderer) Clear()
Clear removes the live region; completed lines remain in scrollback.
func (*Renderer) Complete ¶
Complete replaces an active row with caller-formatted permanent output. The callback executes synchronously on the renderer's owner goroutine.