Skip to main content

Module hlc

Module hlc 

Source
Expand description

Hybrid logical clocks (PROTOCOL.md §5).

A stamp is wall_ms:counter:node_id: 13 digits, 5 digits (0–65,535) and 1–64 characters of [A-Za-z0-9_-]. Canonical stamps compare as strings.

Structs§

Clock
A thread-safe clock that issues strictly increasing stamps (§5.2).
Hlc
One parsed HLC stamp.

Constants§

MAX_COUNTER
The counter’s maximum (a 16-bit unsigned integer).

Functions§

compare
Compares two stamps. Unparseable stamps fall back to string order, which is the same order for canonical stamps.
newer
True when hlc is newer than than (or than is absent).
now_ms
Milliseconds since the Unix epoch.
random_node
A random node id for a new installation (rs- + 12 hex characters).
valid_node
A node id is 1–64 characters of [A-Za-z0-9_-].