Skip to main content

LeaderElection

Trait LeaderElection 

Source
pub trait LeaderElection {
    // Required methods
    fn current_role(&self) -> NodeRole;
    fn vote(&mut self, candidate: &NodeId) -> SyncResult<()>;
    fn become_leader(&mut self) -> SyncResult<()>;
}
Expand description

Leader election contract.

Required Methods§

Source

fn current_role(&self) -> NodeRole

Returns the node’s current election role.

Source

fn vote(&mut self, candidate: &NodeId) -> SyncResult<()>

Records a vote for candidate.

Source

fn become_leader(&mut self) -> SyncResult<()>

Transitions the local node to leader when election rules permit it.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§