pub trait LeaderElection: Send + Sync {
// Required methods
fn try_become_leader<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool, DistributedError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn is_leader(&self) -> bool;
fn step_down<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), DistributedError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Interface for components participating in cluster leader election.
Required Methods§
Sourcefn try_become_leader<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool, DistributedError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn try_become_leader<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool, DistributedError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Attempt to become the leader or renew leadership if already the leader.