pub enum State {
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 State
impl State
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<'de> Deserialize<'de> for State
impl<'de> Deserialize<'de> for State
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<State> for State
impl PartialEq<State> for State
impl Copy for State
impl Eq for State
impl StructuralEq for State
impl StructuralPartialEq for State
Auto Trait Implementations§
impl RefUnwindSafe for State
impl Send for State
impl Sync for State
impl Unpin for State
impl UnwindSafe for State
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.