Trait oasis_core_runtime::transaction::dispatcher::Dispatcher
source · pub trait Dispatcher: Send + Sync {
// Required methods
fn execute_batch(
&self,
ctx: Context<'_>,
batch: &TxnBatch,
in_msgs: &[IncomingMessage],
) -> Result<ExecuteBatchResult, RuntimeError>;
fn check_batch(
&self,
ctx: Context<'_>,
batch: &TxnBatch,
) -> Result<Vec<CheckTxResult>, RuntimeError>;
// Provided methods
fn is_supported(&self) -> bool { ... }
fn schedule_and_execute_batch(
&self,
_ctx: Context<'_>,
_initial_batch: &mut TxnBatch,
_in_msgs: &[IncomingMessage],
) -> Result<ExecuteBatchResult, RuntimeError> { ... }
fn finalize(&self, _new_storage_root: Hash) { ... }
fn set_abort_batch_flag(&mut self, _abort_batch: Arc<AtomicBool>) { ... }
fn query(
&self,
_ctx: Context<'_>,
_method: &str,
_args: Vec<u8>,
) -> Result<Vec<u8>, RuntimeError> { ... }
}
Expand description
Runtime transaction dispatcher trait.
It defines the interface used by the runtime call dispatcher to process transactions.
Required Methods§
sourcefn execute_batch(
&self,
ctx: Context<'_>,
batch: &TxnBatch,
in_msgs: &[IncomingMessage],
) -> Result<ExecuteBatchResult, RuntimeError>
fn execute_batch( &self, ctx: Context<'_>, batch: &TxnBatch, in_msgs: &[IncomingMessage], ) -> Result<ExecuteBatchResult, RuntimeError>
Execute the transactions in the given batch.
§Consensus Layer State Integrity
Before this method is invoked, consensus layer state integrity verification is performed.
sourcefn check_batch(
&self,
ctx: Context<'_>,
batch: &TxnBatch,
) -> Result<Vec<CheckTxResult>, RuntimeError>
fn check_batch( &self, ctx: Context<'_>, batch: &TxnBatch, ) -> Result<Vec<CheckTxResult>, RuntimeError>
Check the transactions in the given batch for validity.
§Consensus Layer State Integrity
No consensus layer state integrity verification is performed for queries by default. The runtime dispatcher implementation should perform integrity verification if needed on a query-by-query basis.
Provided Methods§
sourcefn is_supported(&self) -> bool
fn is_supported(&self) -> bool
Whether dispatch is supported by this dispatcher.
sourcefn schedule_and_execute_batch(
&self,
_ctx: Context<'_>,
_initial_batch: &mut TxnBatch,
_in_msgs: &[IncomingMessage],
) -> Result<ExecuteBatchResult, RuntimeError>
fn schedule_and_execute_batch( &self, _ctx: Context<'_>, _initial_batch: &mut TxnBatch, _in_msgs: &[IncomingMessage], ) -> Result<ExecuteBatchResult, RuntimeError>
Schedule and execute transactions in the given batch.
The passed batch is an initial batch. In case the runtime needs additional items it should request them from the host.
§Consensus Layer State Integrity
Before this method is invoked, consensus layer state integrity verification is performed.
sourcefn set_abort_batch_flag(&mut self, _abort_batch: Arc<AtomicBool>)
fn set_abort_batch_flag(&mut self, _abort_batch: Arc<AtomicBool>)
Configure abort batch flag.
sourcefn query(
&self,
_ctx: Context<'_>,
_method: &str,
_args: Vec<u8>,
) -> Result<Vec<u8>, RuntimeError>
fn query( &self, _ctx: Context<'_>, _method: &str, _args: Vec<u8>, ) -> Result<Vec<u8>, RuntimeError>
Process a query.
§Consensus Layer State Integrity
No consensus layer state integrity verification is performed for queries by default. The runtime dispatcher implementation should perform integrity verification if needed on a query-by-query basis.