Trait ConsensusAdapter

Source
pub trait ConsensusAdapter: Send + Sync {
Show 15 methods // 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 Self: 'async_trait, 'life0: '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 Self: 'async_trait, 'life0: '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 Self: 'async_trait, 'life0: '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 Self: 'async_trait, 'life0: '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 Self: 'async_trait, 'life0: 'async_trait, 'life1: '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 Self: 'async_trait, 'life0: '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 Self: 'async_trait, 'life0: 'async_trait; fn save_epoch<'life0, 'async_trait>( &'life0 self, ctx: Context, epoch: Epoch, ) -> Pin<Box<dyn Future<Output = ProtocolResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn save_proof<'life0, 'async_trait>( &'life0 self, ctx: Context, proof: Proof, ) -> Pin<Box<dyn Future<Output = ProtocolResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: '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 Self: 'async_trait, 'life0: '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 Self: 'async_trait, 'life0: '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 Self: 'async_trait, 'life0: '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 Self: 'async_trait, 'life0: 'async_trait, 'life1: '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 Self: 'async_trait, 'life0: 'async_trait, 'life1: '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 Self: 'async_trait, 'life0: 'async_trait;
}

Required Methods§

Source

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 Self: 'async_trait, 'life0: '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.

Source

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

Check the correctness of the given transactions.

Source

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

Synchronous signed transactions.

Source

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 Self: 'async_trait, 'life0: 'async_trait,

Get the signed transactions corresponding to the given hashes.

Source

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 Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Consensus transmit a message to the given target.

Source

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 Self: 'async_trait, 'life0: 'async_trait,

Execute some transactions.

Source

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

Flush the given transactions in the mempool.

Source

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

Save an epoch to the database.

Source

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

Source

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 Self: 'async_trait, 'life0: 'async_trait,

Save some signed transactions to the database.

Source

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 Self: 'async_trait, 'life0: 'async_trait,

Get the validator list of the given last epoch.

Source

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

Get the current epoch ID from storage.

Source

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 Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Pull some epochs from other nodes from begin to end.

Source

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 Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

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

Source

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 Self: 'async_trait, 'life0: 'async_trait,

Get an epoch corresponding to the given epoch ID.

Implementors§