pub enum Message {
RequestVoteCall {
header: MessageHeader,
last_position: LogPosition,
},
RequestVoteReply {
header: MessageHeader,
vote_granted: bool,
},
AppendEntriesCall {
header: MessageHeader,
commit_index: LogIndex,
entries: LogEntries,
},
AppendEntriesReply {
header: MessageHeader,
last_position: LogPosition,
},
}Expand description
Message for RPC.
Note that this enum does not include the InstallSnapshot RPC, as the specifics of snapshot installation depend heavily on each individual application and are not managed by this crate.
Variants§
RequestVoteCall
RequestVote RPC call.
Fields
header: MessageHeaderMessage header.
last_position: LogPositionLast log position of the candidate.
RequestVoteReply
RequestVote RPC reply.
AppendEntriesCall
AppendEntries RPC call.
Fields
header: MessageHeaderMessage header.
entries: LogEntriesEntries to append.
Note that if the entries are too large to fit in a single message,
it can be shrinked by calling LogEntries::truncate() before sending.
AppendEntriesReply
AppendEntries RPC reply.
Fields
header: MessageHeaderMessage header.
last_position: LogPositionLast log position of the follower.
Instead of replying a boolean success as defined in the Raft paper,
this crate replies the last log position of the follower.
With this adjustment, the leader can quickly determine the appropriate match index of the follower,
even if the follower is significantly behind the leader.