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
doneonly grows and never passestotal, which never shrinks. - Progress
Channel - 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.
- Progress
Report - 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_INTERVALhas passed since the one before. Reporting stores the newest value and writes nothing to a database. - Progress
Watch - Hears the progress an owner’s operation reports into its
ProgressChannel, for a host that draws it. - Recording
Clock - 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
workto its end, callingreporton this task with the progress it reports intoprogress. A host that redraws more slowly thanworkreports sees the newest value, never an older one after it; a report made just beforeworkends is still delivered, and none twice. What the watch held beforeprogresssubscribed belongs to an earlier operation and is never delivered.