pub struct ApprovalId(/* private fields */);Expand description
Non-empty item identity, derived from the run that raises the item and that run’s own position counter — never from a clock. Four lanes drive at once by default, so two runs reach their first question in one millisecond routinely; a clock-shaped identity makes those two items one key, the inbox keeps the later one, and the earlier one disappears from an append-only history that cannot afterwards tell a lost item from an item that was never raised.
Implementations§
Source§impl ApprovalId
impl ApprovalId
Sourcepub fn of(run: &RunId, seq: Seq) -> ApprovalId
pub fn of(run: &RunId, seq: Seq) -> ApprovalId
Mints the identity of the question run may raise at seq.
seq is the run’s own monotonic position — the counter the run
already keeps to derive crate::IdemKey, counted inside one run
and never across runs, so a position is only ever an identity
together with the run it was counted in. Replay re-derives the
identical id because neither input is sampled: this is what keeps
just replay self-proving over the approval records.
The position is written zero-padded to the width of u64::MAX, so
the derived Ord on two ids of one run reads the order the run
raised them in.
Sourcepub fn of_sweep(run: &RunId) -> ApprovalId
pub fn of_sweep(run: &RunId) -> ApprovalId
Mints the identity of the one question a drive’s own sweep may raise, which happens at most once per run.
The sweep sits at the highest position, which no call position can reach, because the sweep counts nothing and the run’s call counter must stay free to hand out every position it reaches.
Sourcepub fn new(raw: impl Into<String>) -> Option<ApprovalId>
pub fn new(raw: impl Into<String>) -> Option<ApprovalId>
Adopts an id that already exists — one echoed back over the wire,
one read from the ledger, one written into a fixture. Minting is
ApprovalId::of; this path only refuses the empty string.