pub trait Storage: AutoTraits + Sized {
type Context: Context<Extra = ChainRuntimeContext<Self>> + Clone + 'static;
type Clock: Clock + Clone + Send + Sync;
type BlockExporterContext: Context<Extra = u32> + Clone;
Show 38 methods
// Required methods
fn clock(&self) -> &Self::Clock;
fn thread_pool(&self) -> &Arc<ThreadPool>;
fn load_chain<'life0, 'async_trait>(
&'life0 self,
id: ChainId,
) -> Pin<Box<dyn Future<Output = Result<ChainStateView<Self::Context>, ViewError>> + 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 missing_blobs<'life0, 'life1, 'async_trait>(
&'life0 self,
blob_ids: &'life1 [BlobId],
) -> Pin<Box<dyn Future<Output = Result<Vec<BlobId>, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn contains_blob_state<'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 read_confirmed_block<'life0, 'async_trait>(
&'life0 self,
hash: CryptoHash,
) -> Pin<Box<dyn Future<Output = Result<Option<ConfirmedBlock>, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn read_confirmed_blocks<'life0, 'async_trait, I>(
&'life0 self,
hashes: I,
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<ConfirmedBlock>>, ViewError>> + Send + 'async_trait>>
where I: 'async_trait + IntoIterator<Item = CryptoHash> + Send,
Self: 'async_trait,
'life0: 'async_trait;
fn read_blob<'life0, 'async_trait>(
&'life0 self,
blob_id: BlobId,
) -> Pin<Box<dyn Future<Output = Result<Option<Blob>, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn read_blobs<'life0, 'life1, 'async_trait>(
&'life0 self,
blob_ids: &'life1 [BlobId],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<Blob>>, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn read_blob_state<'life0, 'async_trait>(
&'life0 self,
blob_id: BlobId,
) -> Pin<Box<dyn Future<Output = Result<Option<BlobState>, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn read_blob_states<'life0, 'life1, 'async_trait>(
&'life0 self,
blob_ids: &'life1 [BlobId],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<BlobState>>, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn write_blob<'life0, 'life1, 'async_trait>(
&'life0 self,
blob: &'life1 Blob,
) -> Pin<Box<dyn Future<Output = Result<(), ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn write_blobs_and_certificate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
blobs: &'life1 [Blob],
certificate: &'life2 ConfirmedBlockCertificate,
) -> Pin<Box<dyn Future<Output = Result<(), ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn maybe_write_blobs<'life0, 'life1, 'async_trait>(
&'life0 self,
blobs: &'life1 [Blob],
) -> Pin<Box<dyn Future<Output = Result<Vec<bool>, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn maybe_write_blob_states<'life0, 'life1, 'async_trait>(
&'life0 self,
blob_ids: &'life1 [BlobId],
blob_state: BlobState,
) -> Pin<Box<dyn Future<Output = Result<(), ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn write_blobs<'life0, 'life1, 'async_trait>(
&'life0 self,
blobs: &'life1 [Blob],
) -> Pin<Box<dyn Future<Output = Result<(), ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn contains_certificate<'life0, 'async_trait>(
&'life0 self,
hash: CryptoHash,
) -> Pin<Box<dyn Future<Output = Result<bool, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn read_certificate<'life0, 'async_trait>(
&'life0 self,
hash: CryptoHash,
) -> Pin<Box<dyn Future<Output = Result<Option<ConfirmedBlockCertificate>, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn read_certificates<'life0, 'life1, 'async_trait>(
&'life0 self,
hashes: &'life1 [CryptoHash],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<ConfirmedBlockCertificate>>, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn read_certificates_raw<'life0, 'life1, 'async_trait>(
&'life0 self,
hashes: &'life1 [CryptoHash],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<(Vec<u8>, Vec<u8>)>>, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn read_certificates_by_heights<'life0, 'life1, 'async_trait>(
&'life0 self,
chain_id: ChainId,
heights: &'life1 [BlockHeight],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<ConfirmedBlockCertificate>>, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn read_certificates_by_heights_raw<'life0, 'life1, 'async_trait>(
&'life0 self,
chain_id: ChainId,
heights: &'life1 [BlockHeight],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<(Vec<u8>, Vec<u8>)>>, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn read_certificate_hashes_by_heights<'life0, 'life1, 'async_trait>(
&'life0 self,
chain_id: ChainId,
heights: &'life1 [BlockHeight],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<CryptoHash>>, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn read_event<'life0, 'async_trait>(
&'life0 self,
id: EventId,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn contains_event<'life0, 'async_trait>(
&'life0 self,
id: EventId,
) -> Pin<Box<dyn Future<Output = Result<bool, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn read_events_from_index<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
chain_id: &'life1 ChainId,
stream_id: &'life2 StreamId,
start_index: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<IndexAndEvent>, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn write_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;
fn read_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 write_network_description<'life0, 'life1, 'async_trait>(
&'life0 self,
information: &'life1 NetworkDescription,
) -> Pin<Box<dyn Future<Output = Result<(), ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn wasm_runtime(&self) -> Option<WasmRuntime>;
fn block_exporter_context<'life0, 'async_trait>(
&'life0 self,
block_exporter_id: u32,
) -> Pin<Box<dyn Future<Output = Result<Self::BlockExporterContext, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn list_blob_ids<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<BlobId>, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn list_chain_ids<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ChainId>, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn list_event_ids<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<EventId>, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn create_chain<'life0, 'async_trait>(
&'life0 self,
description: ChainDescription,
) -> Pin<Box<dyn Future<Output = Result<(), ChainError>> + Send + 'async_trait>>
where ChainRuntimeContext<Self>: ExecutionRuntimeContext,
Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn load_contract<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
application_description: &'life1 ApplicationDescription,
txn_tracker: &'life2 TransactionTracker,
) -> Pin<Box<dyn Future<Output = Result<UserContractCode, ExecutionError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn load_service<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
application_description: &'life1 ApplicationDescription,
txn_tracker: &'life2 TransactionTracker,
) -> Pin<Box<dyn Future<Output = Result<UserServiceCode, ExecutionError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
}Expand description
Communicate with a persistent storage using the “views” abstraction.
Required Associated Types§
Sourcetype Context: Context<Extra = ChainRuntimeContext<Self>> + Clone + 'static
type Context: Context<Extra = ChainRuntimeContext<Self>> + Clone + 'static
The low-level storage implementation in use by the core protocol (chain workers etc).
Sourcetype BlockExporterContext: Context<Extra = u32> + Clone
type BlockExporterContext: Context<Extra = u32> + Clone
The low-level storage implementation in use by the block exporter.
Required Methods§
fn thread_pool(&self) -> &Arc<ThreadPool>
Sourcefn load_chain<'life0, 'async_trait>(
&'life0 self,
id: ChainId,
) -> Pin<Box<dyn Future<Output = Result<ChainStateView<Self::Context>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load_chain<'life0, 'async_trait>(
&'life0 self,
id: ChainId,
) -> Pin<Box<dyn Future<Output = Result<ChainStateView<Self::Context>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Loads the view of a chain state.
§Notes
Each time this method is called, a new ChainStateView is created. If there are multiple
instances of the same chain active at any given moment, they will race to access persistent
storage. This can lead to invalid states and data corruption.
Sourcefn 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_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,
Tests the existence of a blob with the given blob ID.
Sourcefn missing_blobs<'life0, 'life1, 'async_trait>(
&'life0 self,
blob_ids: &'life1 [BlobId],
) -> Pin<Box<dyn Future<Output = Result<Vec<BlobId>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn missing_blobs<'life0, 'life1, 'async_trait>(
&'life0 self,
blob_ids: &'life1 [BlobId],
) -> Pin<Box<dyn Future<Output = Result<Vec<BlobId>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Returns what blobs from the input are missing from storage.
Sourcefn contains_blob_state<'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_blob_state<'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,
Tests existence of a blob state with the given blob ID.
Sourcefn read_confirmed_block<'life0, 'async_trait>(
&'life0 self,
hash: CryptoHash,
) -> Pin<Box<dyn Future<Output = Result<Option<ConfirmedBlock>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read_confirmed_block<'life0, 'async_trait>(
&'life0 self,
hash: CryptoHash,
) -> Pin<Box<dyn Future<Output = Result<Option<ConfirmedBlock>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Reads the hashed certificate value with the given hash.
Sourcefn read_confirmed_blocks<'life0, 'async_trait, I>(
&'life0 self,
hashes: I,
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<ConfirmedBlock>>, ViewError>> + Send + 'async_trait>>where
I: 'async_trait + IntoIterator<Item = CryptoHash> + Send,
Self: 'async_trait,
'life0: 'async_trait,
fn read_confirmed_blocks<'life0, 'async_trait, I>(
&'life0 self,
hashes: I,
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<ConfirmedBlock>>, ViewError>> + Send + 'async_trait>>where
I: 'async_trait + IntoIterator<Item = CryptoHash> + Send,
Self: 'async_trait,
'life0: 'async_trait,
Reads a number of confirmed blocks by their hashes.
Sourcefn read_blob<'life0, 'async_trait>(
&'life0 self,
blob_id: BlobId,
) -> Pin<Box<dyn Future<Output = Result<Option<Blob>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read_blob<'life0, 'async_trait>(
&'life0 self,
blob_id: BlobId,
) -> Pin<Box<dyn Future<Output = Result<Option<Blob>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Reads the blob with the given blob ID.
Sourcefn read_blobs<'life0, 'life1, 'async_trait>(
&'life0 self,
blob_ids: &'life1 [BlobId],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<Blob>>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_blobs<'life0, 'life1, 'async_trait>(
&'life0 self,
blob_ids: &'life1 [BlobId],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<Blob>>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Reads the blobs with the given blob IDs.
Sourcefn read_blob_state<'life0, 'async_trait>(
&'life0 self,
blob_id: BlobId,
) -> Pin<Box<dyn Future<Output = Result<Option<BlobState>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read_blob_state<'life0, 'async_trait>(
&'life0 self,
blob_id: BlobId,
) -> Pin<Box<dyn Future<Output = Result<Option<BlobState>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Reads the blob state with the given blob ID.
Sourcefn read_blob_states<'life0, 'life1, 'async_trait>(
&'life0 self,
blob_ids: &'life1 [BlobId],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<BlobState>>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_blob_states<'life0, 'life1, 'async_trait>(
&'life0 self,
blob_ids: &'life1 [BlobId],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<BlobState>>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Reads the blob states with the given blob IDs.
Sourcefn write_blob<'life0, 'life1, 'async_trait>(
&'life0 self,
blob: &'life1 Blob,
) -> Pin<Box<dyn Future<Output = Result<(), ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn write_blob<'life0, 'life1, 'async_trait>(
&'life0 self,
blob: &'life1 Blob,
) -> Pin<Box<dyn Future<Output = Result<(), ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Writes the given blob.
Sourcefn write_blobs_and_certificate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
blobs: &'life1 [Blob],
certificate: &'life2 ConfirmedBlockCertificate,
) -> Pin<Box<dyn Future<Output = Result<(), ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn write_blobs_and_certificate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
blobs: &'life1 [Blob],
certificate: &'life2 ConfirmedBlockCertificate,
) -> Pin<Box<dyn Future<Output = Result<(), ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Writes blobs and certificate
Sourcefn maybe_write_blobs<'life0, 'life1, 'async_trait>(
&'life0 self,
blobs: &'life1 [Blob],
) -> Pin<Box<dyn Future<Output = Result<Vec<bool>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn maybe_write_blobs<'life0, 'life1, 'async_trait>(
&'life0 self,
blobs: &'life1 [Blob],
) -> Pin<Box<dyn Future<Output = Result<Vec<bool>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Writes the given blobs, but only if they already have a blob state. Returns true for the
blobs that were written.
Sourcefn maybe_write_blob_states<'life0, 'life1, 'async_trait>(
&'life0 self,
blob_ids: &'life1 [BlobId],
blob_state: BlobState,
) -> Pin<Box<dyn Future<Output = Result<(), ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn maybe_write_blob_states<'life0, 'life1, 'async_trait>(
&'life0 self,
blob_ids: &'life1 [BlobId],
blob_state: BlobState,
) -> Pin<Box<dyn Future<Output = Result<(), ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Attempts to write the given blob state. Returns the latest Epoch to have used this blob.
Sourcefn write_blobs<'life0, 'life1, 'async_trait>(
&'life0 self,
blobs: &'life1 [Blob],
) -> Pin<Box<dyn Future<Output = Result<(), ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn write_blobs<'life0, 'life1, 'async_trait>(
&'life0 self,
blobs: &'life1 [Blob],
) -> Pin<Box<dyn Future<Output = Result<(), ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Writes several blobs.
Sourcefn contains_certificate<'life0, 'async_trait>(
&'life0 self,
hash: CryptoHash,
) -> Pin<Box<dyn Future<Output = Result<bool, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn contains_certificate<'life0, 'async_trait>(
&'life0 self,
hash: CryptoHash,
) -> Pin<Box<dyn Future<Output = Result<bool, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Tests existence of the certificate with the given hash.
Sourcefn read_certificate<'life0, 'async_trait>(
&'life0 self,
hash: CryptoHash,
) -> Pin<Box<dyn Future<Output = Result<Option<ConfirmedBlockCertificate>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read_certificate<'life0, 'async_trait>(
&'life0 self,
hash: CryptoHash,
) -> Pin<Box<dyn Future<Output = Result<Option<ConfirmedBlockCertificate>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Reads the certificate with the given hash.
Sourcefn read_certificates<'life0, 'life1, 'async_trait>(
&'life0 self,
hashes: &'life1 [CryptoHash],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<ConfirmedBlockCertificate>>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_certificates<'life0, 'life1, 'async_trait>(
&'life0 self,
hashes: &'life1 [CryptoHash],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<ConfirmedBlockCertificate>>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Reads a number of certificates
Sourcefn read_certificates_raw<'life0, 'life1, 'async_trait>(
&'life0 self,
hashes: &'life1 [CryptoHash],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<(Vec<u8>, Vec<u8>)>>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_certificates_raw<'life0, 'life1, 'async_trait>(
&'life0 self,
hashes: &'life1 [CryptoHash],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<(Vec<u8>, Vec<u8>)>>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Reads raw certificate bytes by hashes.
Returns a vector where each element corresponds to the input hash.
Elements are None if no certificate exists for that hash.
Each found certificate is returned as Some((lite_certificate_bytes, confirmed_block_bytes)).
Sourcefn read_certificates_by_heights<'life0, 'life1, 'async_trait>(
&'life0 self,
chain_id: ChainId,
heights: &'life1 [BlockHeight],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<ConfirmedBlockCertificate>>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_certificates_by_heights<'life0, 'life1, 'async_trait>(
&'life0 self,
chain_id: ChainId,
heights: &'life1 [BlockHeight],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<ConfirmedBlockCertificate>>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Reads certificates by heights for a given chain.
Returns a vector where each element corresponds to the input height.
Elements are None if no certificate exists at that height.
Sourcefn read_certificates_by_heights_raw<'life0, 'life1, 'async_trait>(
&'life0 self,
chain_id: ChainId,
heights: &'life1 [BlockHeight],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<(Vec<u8>, Vec<u8>)>>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_certificates_by_heights_raw<'life0, 'life1, 'async_trait>(
&'life0 self,
chain_id: ChainId,
heights: &'life1 [BlockHeight],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<(Vec<u8>, Vec<u8>)>>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Reads raw certificates by heights for a given chain.
Returns a vector where each element corresponds to the input height.
Elements are None if no certificate exists at that height.
Each found certificate is returned as a tuple of (lite_certificate_bytes, confirmed_block_bytes).
Sourcefn read_certificate_hashes_by_heights<'life0, 'life1, 'async_trait>(
&'life0 self,
chain_id: ChainId,
heights: &'life1 [BlockHeight],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<CryptoHash>>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_certificate_hashes_by_heights<'life0, 'life1, 'async_trait>(
&'life0 self,
chain_id: ChainId,
heights: &'life1 [BlockHeight],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<CryptoHash>>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Returns a vector of certificate hashes for the requested chain and heights.
The resulting vector maintains the order of the input heights argument.
Elements are None if no certificate exists at that height.
Sourcefn read_event<'life0, 'async_trait>(
&'life0 self,
id: EventId,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read_event<'life0, 'async_trait>(
&'life0 self,
id: EventId,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Reads the event with the given ID.
Sourcefn contains_event<'life0, 'async_trait>(
&'life0 self,
id: EventId,
) -> 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,
id: EventId,
) -> Pin<Box<dyn Future<Output = Result<bool, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Tests existence of the event with the given ID.
Sourcefn read_events_from_index<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
chain_id: &'life1 ChainId,
stream_id: &'life2 StreamId,
start_index: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<IndexAndEvent>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn read_events_from_index<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
chain_id: &'life1 ChainId,
stream_id: &'life2 StreamId,
start_index: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<IndexAndEvent>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Lists all the events from a starting index
Sourcefn write_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,
fn write_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,
Writes a vector of events.
Sourcefn read_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 read_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,
Reads the network description.
Sourcefn write_network_description<'life0, 'life1, 'async_trait>(
&'life0 self,
information: &'life1 NetworkDescription,
) -> Pin<Box<dyn Future<Output = Result<(), ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn write_network_description<'life0, 'life1, 'async_trait>(
&'life0 self,
information: &'life1 NetworkDescription,
) -> Pin<Box<dyn Future<Output = Result<(), ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Writes the network description.
Sourcefn wasm_runtime(&self) -> Option<WasmRuntime>
fn wasm_runtime(&self) -> Option<WasmRuntime>
Selects the WebAssembly runtime to use for applications (if any).
fn block_exporter_context<'life0, 'async_trait>(
&'life0 self,
block_exporter_id: u32,
) -> Pin<Box<dyn Future<Output = Result<Self::BlockExporterContext, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn list_blob_ids<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<BlobId>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_blob_ids<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<BlobId>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Lists the blob IDs in storage.
Provided Methods§
Sourcefn create_chain<'life0, 'async_trait>(
&'life0 self,
description: ChainDescription,
) -> Pin<Box<dyn Future<Output = Result<(), ChainError>> + Send + 'async_trait>>where
ChainRuntimeContext<Self>: ExecutionRuntimeContext,
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn create_chain<'life0, 'async_trait>(
&'life0 self,
description: ChainDescription,
) -> Pin<Box<dyn Future<Output = Result<(), ChainError>> + Send + 'async_trait>>where
ChainRuntimeContext<Self>: ExecutionRuntimeContext,
Self: Sync + 'async_trait,
'life0: 'async_trait,
Initializes a chain in a simple way (used for testing and to create a genesis state).
§Notes
This method creates a new ChainStateView instance. If there are multiple instances of
the same chain active at any given moment, they will race to access persistent storage.
This can lead to invalid states and data corruption.
Sourcefn load_contract<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
application_description: &'life1 ApplicationDescription,
txn_tracker: &'life2 TransactionTracker,
) -> Pin<Box<dyn Future<Output = Result<UserContractCode, ExecutionError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn load_contract<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
application_description: &'life1 ApplicationDescription,
txn_tracker: &'life2 TransactionTracker,
) -> Pin<Box<dyn Future<Output = Result<UserContractCode, ExecutionError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Creates a UserContractCode instance using the bytecode in storage referenced
by the application_description.
Sourcefn load_service<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
application_description: &'life1 ApplicationDescription,
txn_tracker: &'life2 TransactionTracker,
) -> Pin<Box<dyn Future<Output = Result<UserServiceCode, ExecutionError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn load_service<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
application_description: &'life1 ApplicationDescription,
txn_tracker: &'life2 TransactionTracker,
) -> Pin<Box<dyn Future<Output = Result<UserServiceCode, ExecutionError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Creates a UserServiceCode instance using the bytecode in storage referenced
by the application_description.
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.