Enum openraft::ServerState
source · pub enum ServerState {
Learner,
Follower,
Candidate,
Leader,
Shutdown,
}
Expand description
All possible states of a Raft node.
Variants§
Learner
The node is completely passive; replicating entries, but neither voting nor timing out.
Follower
The node is replicating logs from the leader.
Candidate
The node is campaigning to become the cluster leader.
Leader
The node is the Raft cluster leader.
Shutdown
The Raft node is shutting down.
Implementations§
source§impl ServerState
impl ServerState
sourcepub fn is_learner(&self) -> bool
pub fn is_learner(&self) -> bool
Check if currently in learner state.
sourcepub fn is_follower(&self) -> bool
pub fn is_follower(&self) -> bool
Check if currently in follower state.
sourcepub fn is_candidate(&self) -> bool
pub fn is_candidate(&self) -> bool
Check if currently in candidate state.
Trait Implementations§
source§impl Clone for ServerState
impl Clone for ServerState
source§fn clone(&self) -> ServerState
fn clone(&self) -> ServerState
Returns a copy 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 ServerState
impl Debug for ServerState
source§impl Default for ServerState
impl Default for ServerState
source§fn default() -> ServerState
fn default() -> ServerState
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for ServerState
impl<'de> Deserialize<'de> for ServerState
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for ServerState
impl PartialEq for ServerState
source§fn eq(&self, other: &ServerState) -> bool
fn eq(&self, other: &ServerState) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for ServerState
impl Serialize for ServerState
impl Copy for ServerState
impl Eq for ServerState
impl StructuralPartialEq for ServerState
Auto Trait Implementations§
impl Freeze for ServerState
impl RefUnwindSafe for ServerState
impl Send for ServerState
impl Sync for ServerState
impl Unpin for ServerState
impl UnwindSafe for ServerState
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