Trait LeaderProvider

Source
pub trait LeaderProvider:
    Debug
    + Send
    + Sync {
    // Required methods
    fn leader(&self) -> Option<String>;
    fn ask_leader<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Provide [MetaClient] a Metasrv leader’s address.

Required Methods§

Source

fn leader(&self) -> Option<String>

Get the leader of the Metasrv. If it returns None, or the leader is outdated, you can use ask_leader to find a new one.

Source

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

Find the current leader of the Metasrv.

Implementors§