Trait executor_types::BlockExecutor
source · pub trait BlockExecutor: Send + Sync {
// Required methods
fn committed_block_id(&self) -> Result<HashValue, Error>;
fn reset(&self) -> Result<(), Error>;
fn execute_block(
&self,
block: (HashValue, Vec<Transaction>),
parent_block_id: HashValue
) -> Result<StateComputeResult, Error>;
fn commit_blocks(
&self,
block_ids: Vec<HashValue>,
ledger_info_with_sigs: LedgerInfoWithSignatures
) -> Result<(), Error>;
}
Required Methods§
sourcefn committed_block_id(&self) -> Result<HashValue, Error>
fn committed_block_id(&self) -> Result<HashValue, Error>
Get the latest committed block id
sourcefn reset(&self) -> Result<(), Error>
fn reset(&self) -> Result<(), Error>
Reset the internal state including cache with newly fetched latest committed block from storage.
sourcefn execute_block(
&self,
block: (HashValue, Vec<Transaction>),
parent_block_id: HashValue
) -> Result<StateComputeResult, Error>
fn execute_block( &self, block: (HashValue, Vec<Transaction>), parent_block_id: HashValue ) -> Result<StateComputeResult, Error>
Executes a block.
sourcefn commit_blocks(
&self,
block_ids: Vec<HashValue>,
ledger_info_with_sigs: LedgerInfoWithSignatures
) -> Result<(), Error>
fn commit_blocks( &self, block_ids: Vec<HashValue>, ledger_info_with_sigs: LedgerInfoWithSignatures ) -> Result<(), 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.