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§
Sourcefn current_role(&self) -> NodeRole
fn current_role(&self) -> NodeRole
Returns the node’s current election role.
Sourcefn vote(&mut self, candidate: &NodeId) -> SyncResult<()>
fn vote(&mut self, candidate: &NodeId) -> SyncResult<()>
Records a vote for candidate.
Sourcefn become_leader(&mut self) -> SyncResult<()>
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".