pub enum Message {
Hb {
epoch: u64,
node_id: String,
role: Role,
repl_offset: u64,
},
Offer {
new_epoch: u64,
candidate_id: String,
repl_offset: u64,
},
Accept {
epoch: u64,
accepter_id: String,
},
Announce {
epoch: u64,
new_primary_id: String,
new_primary_addr: String,
},
}Expand description
One decoded message off the control wire. The four variants mirror the four verbs in the protocol spec.
Variants§
Hb
HB <epoch> <node_id> <role> <repl_offset> — heartbeat.
Sent every hb_interval_ms (default 200 ms) by every node
to every other peer. Receiver updates its per-peer
last-seen + cached view; there is no ACK.
Fields
Offer
OFFER <new_epoch> <candidate_id> <repl_offset> — a
replica that flagged the primary DOWN AND won candidate-
selection (highest offset → lowest node-id) broadcasts
this to ask for quorum ACCEPT.
Fields
Accept
ACCEPT <epoch> <accepter_id> — a peer’s vote for an
OFFER. Each peer casts at most ONE accept per epoch
(prevents two candidates from gathering quorum in the same
round).
Announce
ANNOUNCE <epoch> <new_primary_id> <new_primary_addr> —
the winning candidate broadcasts this on hitting quorum
N/2 + 1 ACCEPTs. Peers update their current_epoch and
current_primary, then retarget kevy-replicate at the
new primary. The old primary (if alive) sees this with a
newer epoch and demotes.