[][src]Trait executor_types::BlockExecutor

pub trait BlockExecutor: Send {
    fn committed_block_id(&mut self) -> Result<HashValue, Error>;
fn reset(&mut self) -> Result<(), Error>;
fn execute_block(
        &mut self,
        block: (HashValue, Vec<Transaction>),
        parent_block_id: HashValue
    ) -> Result<StateComputeResult, Error>;
fn commit_blocks(
        &mut self,
        block_ids: Vec<HashValue>,
        ledger_info_with_sigs: LedgerInfoWithSignatures
    ) -> Result<(Vec<Transaction>, Vec<ContractEvent>), Error>; }

Required methods

fn committed_block_id(&mut self) -> Result<HashValue, Error>

Get the latest committed block id

fn reset(&mut self) -> Result<(), Error>

Reset the internal state including cache with newly fetched latest committed block from storage.

fn execute_block(
    &mut self,
    block: (HashValue, Vec<Transaction>),
    parent_block_id: HashValue
) -> Result<StateComputeResult, Error>

Executes a block.

fn commit_blocks(
    &mut self,
    block_ids: Vec<HashValue>,
    ledger_info_with_sigs: LedgerInfoWithSignatures
) -> Result<(Vec<Transaction>, Vec<ContractEvent>), Error>

Saves eligible blocks to persistent storage. If we have multiple blocks and not all of them have signatures, we may send them to storage in a few batches. For example, if we have

A <- B <- C <- D <- E

and only C and E have signatures, we will send A, B and C in the first batch, then D and E later in the another batch. Commits a block and all its ancestors in a batch manner.

Returns Ok(Result<Vec<Transaction>, Vec<ContractEvents>) if successful, where Vec is a vector of transactions that were kept from the submitted blocks, and Vec is a vector of reconfiguration events in the submitted blocks

Loading content...

Implementors

Loading content...