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 PartialEq<ServerState> for ServerState
impl PartialEq<ServerState> 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 ==
.impl Copy for ServerState
impl Eq for ServerState
impl StructuralEq for ServerState
impl StructuralPartialEq for ServerState
Auto Trait Implementations§
impl RefUnwindSafe for ServerState
impl Send for ServerState
impl Sync for ServerState
impl Unpin for ServerState
impl UnwindSafe for ServerState
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.