Documentation
¶
Overview ¶
Package progress reports how far a long-running store operation has got. A caller puts a Func in the context it runs the operation with; the operation reports each phase it enters and its counts as they move:
ctx = progress.NewContext(ctx, func(u progress.Update) { ... })
report, err := store.Collect(ctx, opts)
Index ¶
Constants ¶
const ( OpCollect = "collect" OpCompact = "compact" OpRewrite = "rewrite" OpScrub = "scrub" OpRetire = "retire" OpReIndex = "reindex" )
Operations, the Op of an Update.
const ( // collect: snapshot, roots, mark, merge, confirm, then publish or // sweep, then purge. PhaseSnapshot = "snapshot" PhaseRoots = "roots" PhaseMark = "mark" PhaseMerge = "merge" PhaseConfirm = "confirm" PhasePublish = "publish" PhaseSweep = "sweep" PhasePurge = "purge" // compact and rewrite. PhaseRewrite = "rewrite" // scrub. PhaseScrub = "scrub" // retire: due, tombstones, rows, prune. PhaseDue = "due" PhaseTombstones = "tombstones" PhaseRows = "rows" PhasePrune = "prune" // reindex: tombstones, pins, commits, sets, policies, damage. PhasePins = "pins" PhaseCommits = "commits" PhaseSets = "sets" PhasePolicies = "policies" PhaseDamage = "damage" )
Phases, the Phase of an Update. An operation enters its phases in the order listed for it and may skip some; RewritePlan enters its phase once per plan.
const Interval = time.Second
Interval is the least time between two updates of a phase, apart from the first and the last.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Func ¶
type Func func(Update)
Func receives the updates of the operations run with a context that carries it. One operation never calls it concurrently, but may call it from any of its goroutines, so it should return quickly. A Func shared by operations that run at the same time must be safe for concurrent use.
func FromContext ¶
FromContext returns the Func ctx carries, or nil.
type Phase ¶
type Phase struct {
// contains filtered or unexported fields
}
Phase counts the progress of one phase and reports it. Its methods are safe for concurrent use, and do nothing on a nil Phase.
func Start ¶
Start reports that ctx's operation op entered phase, with the totals it knows, and returns the Phase to count it with. It returns nil when ctx carries no Func.