Skip to main content

PrimaryCallback

Trait PrimaryCallback 

Source
pub trait PrimaryCallback<N: Network>: Send + Sync {
    // Required methods
    fn try_advance_to_next_round(&self, current_round: u64) -> bool;
    fn add_new_certificate<'life0, 'async_trait>(
        &'life0 self,
        certificate: BatchCertificate<N>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

This callback trait allows listening to changes in the Primary, such as round advancement. This is implemented by [BFT].

Required Methods§

Source

fn try_advance_to_next_round(&self, current_round: u64) -> bool

Asks the callback to if we can move to the next round.

§Arguments
  • current_round - the round the Primary is in (to avoid race conditions)
§Returns

true if we moved to the next round.

Source

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

Add a certificated that was created by the primary or received from a peer.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§