pub enum Message {
RequestVote {
term: Term,
last_log_index: LogIndex,
last_log_term: Term,
},
RequestVoteResponse {
term: Term,
vote_granted: bool,
},
RequestPreVote {
term: Term,
last_log_index: LogIndex,
last_log_term: Term,
},
RequestPreVoteResponse {
term: Term,
vote_granted: bool,
},
AppendEntries {
term: Term,
prev_log_index: LogIndex,
prev_log_term: Term,
entries: Vec<LogEntry>,
leader_commit: LogIndex,
read_round: u64,
},
AppendEntriesResponse {
term: Term,
success: bool,
match_index: LogIndex,
conflict_index: LogIndex,
conflict_term: Term,
read_round: u64,
},
InstallSnapshot {
term: Term,
last_included_index: LogIndex,
last_included_term: Term,
config: ClusterConfig,
offset: u64,
data: Vec<u8>,
done: bool,
},
InstallSnapshotResponse {
term: Term,
match_index: LogIndex,
},
}Expand description
One RPC message.
The sender and recipient travel in the envelope
(Event::Message::from and Action::Send::to); every variant carries
the term it was created under so stale senders are detectable from the
message alone.
Variants§
RequestVote
A candidate asks for a vote in a real election.
Fields
RequestVoteResponse
The voter’s answer to RequestVote.
Fields
RequestPreVote
A pre-candidate asks whether it would win an election for the
hypothetical term term (the sender’s current term + 1), without
the sender changing any persistent state.
Fields
RequestPreVoteResponse
The voter’s answer to RequestPreVote. Granting it changed no
persistent state on the voter and did not reset its timer.
Fields
AppendEntries
The leader replicates entries (or, with no entries, heartbeats) to a follower.
Fields
AppendEntriesResponse
The follower’s answer to AppendEntries.
Fields
match_index: LogIndexOn success, the highest index the follower now holds contiguously from this leader. Zero on failure.
conflict_index: LogIndexOn failure, the first index of the conflicting term in the follower’s log, or its last index + 1 when its log is too short. Zero when not applicable.
InstallSnapshot
One chunk of a snapshot transfer (docs/ARCHITECTURE.md section
7.4). Chunks of one snapshot identity arrive in strictly
increasing offset order; done marks the final chunk.
Fields
config: ClusterConfigThe configuration in force at last_included_index.
InstallSnapshotResponse
The follower’s answer to an InstallSnapshot chunk.