Skip to main content

TransactionExecutor

Trait TransactionExecutor 

Source
pub trait TransactionExecutor: Send + Sync {
    // Required methods
    fn execute_transaction<'life0, 'async_trait>(
        &'life0 self,
        request: ExecuteTransactionRequestV1,
        skip_certification: bool,
        client_addr: Option<SocketAddr>,
    ) -> Pin<Box<dyn Future<Output = Result<ExecuteTransactionResponseV1, QuorumDriverError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn simulate_transaction(
        &self,
        transaction: Transaction,
        checks: VmChecks,
    ) -> Result<SimulateTransactionResult, IotaError>;
    fn wait_for_checkpoint_inclusion<'life0, 'life1, 'async_trait>(
        &'life0 self,
        digests: &'life1 [TransactionDigest],
        timeout: Duration,
    ) -> Pin<Box<dyn Future<Output = Result<BTreeMap<TransactionDigest, (CheckpointSequenceNumber, u64)>, IotaError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn retain_cached_objects(&self) -> Box<dyn Send + Sync> { ... }
    fn read_transaction_from_cache(
        &self,
        digest: &TransactionDigest,
        include_events: bool,
        include_input_objects: bool,
        include_output_objects: bool,
    ) -> Result<Option<CachedTransactionData>, IotaError> { ... }
}
Expand description

Trait to define the interface for how the REST service interacts with a QuorumDriver or a simulated transaction executor.

Required Methods§

Source

fn execute_transaction<'life0, 'async_trait>( &'life0 self, request: ExecuteTransactionRequestV1, skip_certification: bool, client_addr: Option<SocketAddr>, ) -> Pin<Box<dyn Future<Output = Result<ExecuteTransactionResponseV1, QuorumDriverError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn simulate_transaction( &self, transaction: Transaction, checks: VmChecks, ) -> Result<SimulateTransactionResult, IotaError>

Source

fn wait_for_checkpoint_inclusion<'life0, 'life1, 'async_trait>( &'life0 self, digests: &'life1 [TransactionDigest], timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<BTreeMap<TransactionDigest, (CheckpointSequenceNumber, u64)>, IotaError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Wait for the given transactions to be included in a checkpoint.

Returns a mapping from transaction digest to (checkpoint_sequence_number, checkpoint_timestamp_ms). On timeout, returns partial results for any transactions that were already checkpointed.

Provided Methods§

Source

fn retain_cached_objects(&self) -> Box<dyn Send + Sync>

Keeps the objects that read_transaction_from_cache returns for transactions executed from now on readable until the returned value is dropped. Take it before executing transactions whose objects are read from the cache afterwards. Executors that do not prune retain nothing.

Source

fn read_transaction_from_cache( &self, digest: &TransactionDigest, include_events: bool, include_input_objects: bool, include_output_objects: bool, ) -> Result<Option<CachedTransactionData>, IotaError>

Read authoritative effects, events, and input/output objects for a locally-executed transaction from the cache. Used by callers that have already waited for checkpoint inclusion and want to discard any uncertified single-validator copies.

Returns Ok(None) if the tx is not in the cache, or if the executor does not maintain a local cache (e.g. simulacrum).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§