Skip to main content

Module clock

Module clock 

Source
Expand description

Master time (B225, B228): the one clock every liveness decision of the cluster reads.

The master is handed the wall clock (now) for what people see and what the database keeps: schedules, the times shown, retention. Whether a worker is lost, an assignment has waited too long, a parse or connection job overran, or a moved cleanup may start is decided on master time instead: the master’s monotonic clock, which never steps. It is a [Timestamp] on a timeline of its own (the wall clock when the process first read it, plus the monotonic time since), so the code comparing times stays as it was; such times are never stored as wall-clock ones, nor compared with them. Workers read it from the clock every master message carries (MasterClock).

A test hands the master its own times and these follow them (as_given), so a test moves master time by the now it passes.

Functions§

as_given
Master time as the time handed (tests: they move it with the now they pass).
monotonic
Master time from the monotonic clock (production): the wall clock at the process’s first reading, plus the monotonic time since. now is ignored.
timeline
This master process’s timeline: master times of another process aren’t comparable.

Type Aliases§

Steady
How the master reads master time, from the wall-clock time it was handed.