pub struct VolatileState {
pub node_state: NodeState,
pub leader_id: Option<NodeId>,
}Expand description
Volatile state on all servers
Fields§
§node_state: NodeStateCurrent node state
leader_id: Option<NodeId>Current known leader ID (None if unknown)
Implementations§
Source§impl VolatileState
impl VolatileState
Sourcepub fn become_follower(&mut self, leader_id: Option<NodeId>)
pub fn become_follower(&mut self, leader_id: Option<NodeId>)
Transition to follower state
Sourcepub fn become_candidate(&mut self)
pub fn become_candidate(&mut self)
Transition to candidate state
Sourcepub fn become_leader(&mut self)
pub fn become_leader(&mut self)
Transition to leader state
Sourcepub fn is_candidate(&self) -> bool
pub fn is_candidate(&self) -> bool
Check if this node is a candidate
Sourcepub fn is_follower(&self) -> bool
pub fn is_follower(&self) -> bool
Check if this node is a follower
Trait Implementations§
Source§impl Clone for VolatileState
impl Clone for VolatileState
Source§fn clone(&self) -> VolatileState
fn clone(&self) -> VolatileState
Returns a duplicate of the value. Read more
1.0.0 · 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 VolatileState
impl Debug for VolatileState
Auto Trait Implementations§
impl Freeze for VolatileState
impl RefUnwindSafe for VolatileState
impl Send for VolatileState
impl Sync for VolatileState
impl Unpin for VolatileState
impl UnwindSafe for VolatileState
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