[][src]Trait overlord::Consensus

pub trait Consensus<T: Codec>: Send + Sync {
    fn get_block<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context,
        height: u64
    ) -> Pin<Box<dyn Future<Output = Result<(T, Hash), Box<dyn Error + Send>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn check_block<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context,
        height: u64,
        hash: Hash,
        block: T
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn commit<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context,
        height: u64,
        commit: Commit<T>
    ) -> Pin<Box<dyn Future<Output = Result<Status, Box<dyn Error + Send>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn get_authority_list<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context,
        height: u64
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Node>, Box<dyn Error + Send>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn broadcast_to_other<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context,
        msg: OverlordMsg<T>
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn transmit_to_relayer<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context,
        addr: Address,
        msg: OverlordMsg<T>
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; }

Trait for some functions that consensus needs.

Required methods

fn get_block<'life0, 'async_trait>(
    &'life0 self,
    ctx: Context,
    height: u64
) -> Pin<Box<dyn Future<Output = Result<(T, Hash), Box<dyn Error + Send>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Get a block of the given height and return the block with its hash.

fn check_block<'life0, 'async_trait>(
    &'life0 self,
    ctx: Context,
    height: u64,
    hash: Hash,
    block: T
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Check the correctness of a block. If is passed, return the integrated transcations to do data persistence.

fn commit<'life0, 'async_trait>(
    &'life0 self,
    ctx: Context,
    height: u64,
    commit: Commit<T>
) -> Pin<Box<dyn Future<Output = Result<Status, Box<dyn Error + Send>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Commit a given height to execute and return the rich status.

fn get_authority_list<'life0, 'async_trait>(
    &'life0 self,
    ctx: Context,
    height: u64
) -> Pin<Box<dyn Future<Output = Result<Vec<Node>, Box<dyn Error + Send>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Get an authority list of the given height.

fn broadcast_to_other<'life0, 'async_trait>(
    &'life0 self,
    ctx: Context,
    msg: OverlordMsg<T>
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Broadcast a message to other replicas.

fn transmit_to_relayer<'life0, 'async_trait>(
    &'life0 self,
    ctx: Context,
    addr: Address,
    msg: OverlordMsg<T>
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Transmit a message to the Relayer, the third argument is the relayer's address.

Loading content...

Implementors

Loading content...