Skip to main content

ExecutionRuntimeContext

Trait ExecutionRuntimeContext 

Source
pub trait ExecutionRuntimeContext {
Show 16 methods // Required methods fn chain_id(&self) -> ChainId; fn thread_pool(&self) -> &Arc<ThreadPool>; fn execution_runtime_config(&self) -> ExecutionRuntimeConfig; fn user_contracts(&self) -> &Arc<HashMap<ApplicationId, UserContractCode>>; fn user_services(&self) -> &Arc<HashMap<ApplicationId, UserServiceCode>>; fn get_user_contract<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, description: &'life1 ApplicationDescription, txn_tracker: &'life2 TransactionTracker, ) -> Pin<Box<dyn Future<Output = Result<UserContractCode, ExecutionError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn get_user_service<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, description: &'life1 ApplicationDescription, txn_tracker: &'life2 TransactionTracker, ) -> Pin<Box<dyn Future<Output = Result<UserServiceCode, ExecutionError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn get_blob<'life0, 'async_trait>( &'life0 self, blob_id: BlobId, ) -> Pin<Box<dyn Future<Output = Result<Option<Arc<Blob>>, ViewError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_event<'life0, 'async_trait>( &'life0 self, event_id: EventId, ) -> Pin<Box<dyn Future<Output = Result<Option<Arc<Vec<u8>>>, ViewError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_network_description<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<NetworkDescription>, ViewError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_or_load_committee_by_hash<'life0, 'async_trait>( &'life0 self, hash: CryptoHash, ) -> Pin<Box<dyn Future<Output = Result<Arc<Committee>, ExecutionError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn contains_blob<'life0, 'async_trait>( &'life0 self, blob_id: BlobId, ) -> Pin<Box<dyn Future<Output = Result<bool, ViewError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn contains_event<'life0, 'async_trait>( &'life0 self, event_id: EventId, ) -> Pin<Box<dyn Future<Output = Result<bool, ViewError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn add_blobs<'life0, 'async_trait>( &'life0 self, blobs: impl 'async_trait + IntoIterator<Item = Blob> + Send, ) -> Pin<Box<dyn Future<Output = Result<(), ViewError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn add_events<'life0, 'async_trait>( &'life0 self, events: impl 'async_trait + IntoIterator<Item = (EventId, Vec<u8>)> + Send, ) -> Pin<Box<dyn Future<Output = Result<(), ViewError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; // Provided method fn get_committee_hashes<'life0, 'async_trait>( &'life0 self, epoch_range: RangeInclusive<Epoch>, ) -> Pin<Box<dyn Future<Output = Result<BTreeMap<Epoch, CryptoHash>, ExecutionError>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... }
}
Expand description

Requirements for the extra field in our state views (and notably the ExecutionStateView).

Required Methods§

Source

fn chain_id(&self) -> ChainId

Returns the ID of the chain this context belongs to.

Source

fn thread_pool(&self) -> &Arc<ThreadPool>

Returns the thread pool used to run blocking work.

Source

fn execution_runtime_config(&self) -> ExecutionRuntimeConfig

Returns the configuration options for the execution runtime.

Source

fn user_contracts(&self) -> &Arc<HashMap<ApplicationId, UserContractCode>>

Returns the cache of loaded user contracts.

Source

fn user_services(&self) -> &Arc<HashMap<ApplicationId, UserServiceCode>>

Returns the cache of loaded user services.

Source

fn get_user_contract<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, description: &'life1 ApplicationDescription, txn_tracker: &'life2 TransactionTracker, ) -> Pin<Box<dyn Future<Output = Result<UserContractCode, ExecutionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Loads the contract for the given application, instantiating it if necessary.

Source

fn get_user_service<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, description: &'life1 ApplicationDescription, txn_tracker: &'life2 TransactionTracker, ) -> Pin<Box<dyn Future<Output = Result<UserServiceCode, ExecutionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Loads the service for the given application, instantiating it if necessary.

Source

fn get_blob<'life0, 'async_trait>( &'life0 self, blob_id: BlobId, ) -> Pin<Box<dyn Future<Output = Result<Option<Arc<Blob>>, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the blob with the given ID, if it is available.

Source

fn get_event<'life0, 'async_trait>( &'life0 self, event_id: EventId, ) -> Pin<Box<dyn Future<Output = Result<Option<Arc<Vec<u8>>>, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the event with the given ID, if it is available.

Source

fn get_network_description<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<NetworkDescription>, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the network description, if it is available.

Source

fn get_or_load_committee_by_hash<'life0, 'async_trait>( &'life0 self, hash: CryptoHash, ) -> Pin<Box<dyn Future<Output = Result<Arc<Committee>, ExecutionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the committee whose serialized form hashes to hash. Returns ExecutionError::BlobsNotFound if the committee blob is missing from storage.

Implementations should cache results in a process-wide SharedCommittees map so that repeated lookups are cheap across chains.

Source

fn contains_blob<'life0, 'async_trait>( &'life0 self, blob_id: BlobId, ) -> Pin<Box<dyn Future<Output = Result<bool, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns whether a blob with the given ID is available.

Source

fn contains_event<'life0, 'async_trait>( &'life0 self, event_id: EventId, ) -> Pin<Box<dyn Future<Output = Result<bool, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns whether an event with the given ID is available.

Source

fn add_blobs<'life0, 'async_trait>( &'life0 self, blobs: impl 'async_trait + IntoIterator<Item = Blob> + Send, ) -> Pin<Box<dyn Future<Output = Result<(), ViewError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Adds the given blobs to the context, for use in tests.

Source

fn add_events<'life0, 'async_trait>( &'life0 self, events: impl 'async_trait + IntoIterator<Item = (EventId, Vec<u8>)> + Send, ) -> Pin<Box<dyn Future<Output = Result<(), ViewError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Adds the given events to the context, for use in tests.

Provided Methods§

Source

fn get_committee_hashes<'life0, 'async_trait>( &'life0 self, epoch_range: RangeInclusive<Epoch>, ) -> Pin<Box<dyn Future<Output = Result<BTreeMap<Epoch, CryptoHash>, ExecutionError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Returns the committee blob hashes for the epochs in the given range.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§