common_meta::leadership_notifier

Trait LeadershipChangeListener

source
pub trait LeadershipChangeListener: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn on_leader_start<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn on_leader_stop<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

A trait for handling leadership change events in a distributed system.

Required Methods§

source

fn name(&self) -> &str

Returns the listener name.

source

fn on_leader_start<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when the node transitions to the leader role.

source

fn on_leader_stop<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when the node transitions to the follower role.

Implementors§