[][src]Trait muta_protocol::traits::ConsensusAdapter

pub trait ConsensusAdapter: Send + Sync {
    fn get_txs_from_mempool<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context,
        epoch_id: u64,
        cycle_limit: u64
    ) -> Pin<Box<dyn Future<Output = ProtocolResult<MixedTxHashes>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn check_txs<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context,
        txs: Vec<Hash>
    ) -> Pin<Box<dyn Future<Output = ProtocolResult<()>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn sync_txs<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context,
        txs: Vec<Hash>
    ) -> Pin<Box<dyn Future<Output = ProtocolResult<()>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn get_full_txs<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context,
        txs: Vec<Hash>
    ) -> Pin<Box<dyn Future<Output = ProtocolResult<Vec<SignedTransaction>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn transmit<'life0, 'life1, 'async_trait>(
        &'life0 self,
        ctx: Context,
        msg: Vec<u8>,
        end: &'life1 str,
        target: MessageTarget
    ) -> Pin<Box<dyn Future<Output = ProtocolResult<()>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
;
fn execute<'life0, 'async_trait>(
        &'life0 self,
        node_info: NodeInfo,
        order_root: MerkleRoot,
        epoch_id: u64,
        cycles_price: u64,
        coinbase: Address,
        signed_txs: Vec<SignedTransaction>,
        cycles_limit: u64,
        timestamp: u64
    ) -> Pin<Box<dyn Future<Output = ProtocolResult<()>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn flush_mempool<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context,
        txs: Vec<Hash>
    ) -> Pin<Box<dyn Future<Output = ProtocolResult<()>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn save_epoch<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context,
        epoch: Epoch
    ) -> Pin<Box<dyn Future<Output = ProtocolResult<()>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn save_proof<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context,
        proof: Proof
    ) -> Pin<Box<dyn Future<Output = ProtocolResult<()>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn save_signed_txs<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context,
        signed_txs: Vec<SignedTransaction>
    ) -> Pin<Box<dyn Future<Output = ProtocolResult<()>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn get_last_validators<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context,
        epoch_id: u64
    ) -> Pin<Box<dyn Future<Output = ProtocolResult<Vec<Validator>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn get_current_epoch_id<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context
    ) -> Pin<Box<dyn Future<Output = ProtocolResult<u64>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn pull_epoch<'life0, 'life1, 'async_trait>(
        &'life0 self,
        ctx: Context,
        epoch_id: u64,
        end: &'life1 str
    ) -> Pin<Box<dyn Future<Output = ProtocolResult<Epoch>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
;
fn pull_txs<'life0, 'life1, 'async_trait>(
        &'life0 self,
        ctx: Context,
        hashes: Vec<Hash>,
        end: &'life1 str
    ) -> Pin<Box<dyn Future<Output = ProtocolResult<Vec<SignedTransaction>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
;
fn get_epoch_by_id<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context,
        epoch_id: u64
    ) -> Pin<Box<dyn Future<Output = ProtocolResult<Epoch>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; }

Required methods

fn get_txs_from_mempool<'life0, 'async_trait>(
    &'life0 self,
    ctx: Context,
    epoch_id: u64,
    cycle_limit: u64
) -> Pin<Box<dyn Future<Output = ProtocolResult<MixedTxHashes>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Get some transaction hashes of the given epoch ID. The amount of the transactions is limited by the given cycle limit and return a MixedTxHashes struct.

fn check_txs<'life0, 'async_trait>(
    &'life0 self,
    ctx: Context,
    txs: Vec<Hash>
) -> Pin<Box<dyn Future<Output = ProtocolResult<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Check the correctness of the given transactions.

fn sync_txs<'life0, 'async_trait>(
    &'life0 self,
    ctx: Context,
    txs: Vec<Hash>
) -> Pin<Box<dyn Future<Output = ProtocolResult<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Synchronous signed transactions.

fn get_full_txs<'life0, 'async_trait>(
    &'life0 self,
    ctx: Context,
    txs: Vec<Hash>
) -> Pin<Box<dyn Future<Output = ProtocolResult<Vec<SignedTransaction>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Get the signed transactions corresponding to the given hashes.

fn transmit<'life0, 'life1, 'async_trait>(
    &'life0 self,
    ctx: Context,
    msg: Vec<u8>,
    end: &'life1 str,
    target: MessageTarget
) -> Pin<Box<dyn Future<Output = ProtocolResult<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: 'async_trait, 

Consensus transmit a message to the given target.

fn execute<'life0, 'async_trait>(
    &'life0 self,
    node_info: NodeInfo,
    order_root: MerkleRoot,
    epoch_id: u64,
    cycles_price: u64,
    coinbase: Address,
    signed_txs: Vec<SignedTransaction>,
    cycles_limit: u64,
    timestamp: u64
) -> Pin<Box<dyn Future<Output = ProtocolResult<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Execute some transactions.

fn flush_mempool<'life0, 'async_trait>(
    &'life0 self,
    ctx: Context,
    txs: Vec<Hash>
) -> Pin<Box<dyn Future<Output = ProtocolResult<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Flush the given transactions in the mempool.

fn save_epoch<'life0, 'async_trait>(
    &'life0 self,
    ctx: Context,
    epoch: Epoch
) -> Pin<Box<dyn Future<Output = ProtocolResult<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Save an epoch to the database.

fn save_proof<'life0, 'async_trait>(
    &'life0 self,
    ctx: Context,
    proof: Proof
) -> Pin<Box<dyn Future<Output = ProtocolResult<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

fn save_signed_txs<'life0, 'async_trait>(
    &'life0 self,
    ctx: Context,
    signed_txs: Vec<SignedTransaction>
) -> Pin<Box<dyn Future<Output = ProtocolResult<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Save some signed transactions to the database.

fn get_last_validators<'life0, 'async_trait>(
    &'life0 self,
    ctx: Context,
    epoch_id: u64
) -> Pin<Box<dyn Future<Output = ProtocolResult<Vec<Validator>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Get the validator list of the given last epoch.

fn get_current_epoch_id<'life0, 'async_trait>(
    &'life0 self,
    ctx: Context
) -> Pin<Box<dyn Future<Output = ProtocolResult<u64>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Get the current epoch ID from storage.

fn pull_epoch<'life0, 'life1, 'async_trait>(
    &'life0 self,
    ctx: Context,
    epoch_id: u64,
    end: &'life1 str
) -> Pin<Box<dyn Future<Output = ProtocolResult<Epoch>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: 'async_trait, 

Pull some epochs from other nodes from begin to end.

fn pull_txs<'life0, 'life1, 'async_trait>(
    &'life0 self,
    ctx: Context,
    hashes: Vec<Hash>,
    end: &'life1 str
) -> Pin<Box<dyn Future<Output = ProtocolResult<Vec<SignedTransaction>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: 'async_trait, 

Pull signed transactions corresponding to the given hashes from other nodes.

fn get_epoch_by_id<'life0, 'async_trait>(
    &'life0 self,
    ctx: Context,
    epoch_id: u64
) -> Pin<Box<dyn Future<Output = ProtocolResult<Epoch>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Get an epoch corresponding to the given epoch ID.

Loading content...

Implementors

Loading content...