pub struct RequestVote {
pub term: Term,
pub candidate: NodeId,
pub last_log_index: Index,
pub last_log_term: Term,
pub force: bool,
}Expand description
A candidate’s request for a vote in an election.
Sent by a Candidate to every peer when it starts
an election. A recipient grants its vote only if it has not already voted in
this term and the candidate’s log is at least as up to date as its own — the
election restriction that keeps a node missing committed entries from
becoming leader.
§Examples
use raft_io::RequestVote;
let rv = RequestVote {
term: 4, candidate: 2, last_log_index: 9, last_log_term: 3, force: false,
};
assert_eq!(rv.candidate, 2);Fields§
§term: TermThe candidate’s term.
candidate: NodeIdThe candidate requesting the vote.
last_log_index: IndexIndex of the candidate’s last log entry.
last_log_term: TermTerm of the candidate’s last log entry.
force: boolA forced election, requested by the current leader as part of a leadership transfer. A recipient honours it even within the leader-stickiness window, so the hand-off is not blocked by its own loyalty to the departing leader.
Trait Implementations§
Source§impl Clone for RequestVote
impl Clone for RequestVote
Source§fn clone(&self) -> RequestVote
fn clone(&self) -> RequestVote
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RequestVote
impl Debug for RequestVote
Source§impl Deserialize for RequestVote
impl Deserialize for RequestVote
impl Eq for RequestVote
Source§impl PartialEq for RequestVote
impl PartialEq for RequestVote
Source§fn eq(&self, other: &RequestVote) -> bool
fn eq(&self, other: &RequestVote) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for RequestVote
impl Serialize for RequestVote
impl StructuralPartialEq for RequestVote
Auto Trait Implementations§
impl Freeze for RequestVote
impl RefUnwindSafe for RequestVote
impl Send for RequestVote
impl Sync for RequestVote
impl Unpin for RequestVote
impl UnsafeUnpin for RequestVote
impl UnwindSafe for RequestVote
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more