1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/// Identity of one replica in the cluster. Ids are chosen by the operator and must be
/// unique; they never change for a replica's lifetime (its durable state is tied to it).
;
/// Position in the replicated log, from 0. Each slot holds one decided batch of entries.
;
/// Logical clock of one slot: `4 * round + phase`, starting at 4 (round 1, phase 0).
pub type Step = u32;
/// Steps beyond this are rejected as malformed, which keeps step arithmetic from
/// overflowing. Correct replicas stay far below it (a slot needs more than ~256 rounds only
/// with negligible probability, paper ยง4.2.2 fn. 5); only a Byzantine member, outside the
/// crash-fault model, could push a slot near it.
pub const MAX_STEP: Step = u32MAX - 16;
/// Slots past this are rejected so slot arithmetic (window, reservations) cannot overflow.
pub const MAX_SLOT: u64 = u64MAX - ;
/// Reads use the upper half of the id space so logged entries stay contiguous for dedup.
pub const READ_ID_BASE: u64 = 1 << 63;
/// Monotonic time in nanoseconds, supplied by the caller with every call; the epoch is the
/// caller's choice (process start is typical). Only differences matter, and the replica
/// never lets its clock move backwards, so a slightly stale reading is harmless.
;
/// Identifier of a local proposal, returned by [`crate::Replica::propose`] (and
/// `read_barrier`, `propose_reconfiguration`), unique within one incarnation of a
/// replica. Entries in [`crate::Action::Commit`] carry it with their origin and
/// incarnation, which together identify an entry cluster-wide.
/// Treat ids as opaque: reads and logged proposals use separate ranges, so interleaved
/// calls do not return ids in increasing order.
;
/// Identifier of a [`crate::Action::Persist`]; strictly increasing within one incarnation.
;