Skip to main content

Module progress

Module progress 

Source
Expand description

How far a long operation has come, one step at a time, so a host can draw a bar for it instead of a bare spinner (api.md E1).

Structs§

Progress
How far an operation has come: the step it is on, and how many of that step’s units are done out of its total. Each step names its unit. Steps arrive in the order the operation runs them, and within a step done only grows and never passes total, which never shrinks.
ProgressChannel
Where an owner reports each run of one kind of operation, such as a store’s open, for the host watching it. Each run reports into it afresh.
ProgressReport
Reports one operation’s progress into a watch. A step’s beginning and its last unit are always reported; between them, a report waits until REPORT_INTERVAL has passed since the one before. Reporting stores the newest value and writes nothing to a database.
ProgressWatch
Hears the progress an owner’s operation reports into its ProgressChannel, for a host that draws it.
RecordingClock
A clock that keeps every value reported into one watch, for a test that checks steps a host reading the watch could miss. A report reads its clock just before it sends, so what the watch holds at each reading, with what it holds at the end, is every value sent, in order. Time and waits are clock’s.

Constants§

REPORT_INTERVAL
The least time between two reports within one step: a host redraws a few times a second, never once per row.

Functions§

forward
Run work to its end, calling report on this task with the progress it reports into progress. A host that redraws more slowly than work reports sees the newest value, never an older one after it; a report made just before work ends is still delivered, and none twice. What the watch held before progress subscribed belongs to an earlier operation and is never delivered.