Expand description
Hybrid-logical-clock timestamps: the total order behind last-writer-wins
registers. The value model lives here; crate::hlc::Hlc is the
clock-retaining service that mints and advances them.
Structs§
- Hlc
- Timestamp
- A parsed HLC timestamp.
- Updated
AtStamper - The database-owned
_updated_atstamping capability over its sharedHlc.
Constants§
- HIGHWATER_
STATE_ KEY protocol_statekey under which the clock’s high-water mark is persisted, so it cannot regress across restarts (seeHlc::seed). Written whenever the clock advances (host stamp flushed at cycle end, and on apply-merge).- MAX_
FUTURE_ SKEW_ MS - How far ahead of the receiver’s wall clock an incoming
_updated_at’s physical (millis) component may sit and still be treated as honest. A device can legitimately be offline for a long stretch and cross-device wall clocks drift, so the window is generous — 30 days. A stamp beyondreceiver wall + thishas no honest explanation (a broken clock or buggy client), so the receiver refuses to let it win last-writer-wins or ratchet the local clock. The bound is one-sided: only grossly-future stamps are rejected; a stamp in the past is always honest (an offline device’s older edits) and is never bounded.
Functions§
- now_
wall_ ms - The OS wall clock in epoch milliseconds — the same physical source
Hlcstamps from. Production reads “now” through an injected clock (Hlc::wall_now_ms); this is for callers that apply a trusted, already- captured changeset against a raw connection with no injected clock (snapshot round-trips, gate/FK mechanics tests), where the honest receiver-now is real wall time and the future-skew bound is incidental, not under test.