Trait linera_storage::Storage
source · pub trait Storage: Sized {
type Context: Context<Extra = ChainRuntimeContext<Self>> + Clone + Send + Sync + 'static;
type Clock: Clock;
Show 28 methods
// Required methods
fn clock(&self) -> &Self::Clock;
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_hashed_confirmed_block<'life0, 'async_trait>(
&'life0 self,
hash: CryptoHash,
) -> Pin<Box<dyn Future<Output = Result<Hashed<ConfirmedBlock>, 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<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<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<BlobState>, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn read_hashed_confirmed_blocks_downward<'life0, 'async_trait>(
&'life0 self,
from: CryptoHash,
limit: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<Hashed<ConfirmedBlock>>, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: '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 write_blob_state<'life0, 'life1, 'async_trait>(
&'life0 self,
blob_id: BlobId,
blob_state: &'life1 BlobState,
) -> Pin<Box<dyn Future<Output = Result<(), 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;
fn maybe_write_blob_state<'life0, 'async_trait>(
&'life0 self,
blob_id: BlobId,
blob_state: BlobState,
) -> Pin<Box<dyn Future<Output = Result<Epoch, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn maybe_write_blob_states<'life0, 'life1, 'async_trait>(
&'life0 self,
blob_ids: &'life1 [BlobId],
blob_state: BlobState,
overwrite: bool,
) -> Pin<Box<dyn Future<Output = Result<Vec<Epoch>, 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<ConfirmedBlockCertificate, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn read_certificates<'life0, 'async_trait, I>(
&'life0 self,
hashes: I,
) -> Pin<Box<dyn Future<Output = Result<Vec<ConfirmedBlockCertificate>, ViewError>> + Send + 'async_trait>>
where I: 'async_trait + IntoIterator<Item = CryptoHash> + Send,
Self: 'async_trait,
'life0: 'async_trait;
fn read_event<'life0, 'async_trait>(
&'life0 self,
id: EventId,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, 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;
fn wasm_runtime(&self) -> Option<WasmRuntime>;
// Provided methods
fn load_active_chain<'life0, 'async_trait>(
&'life0 self,
id: ChainId,
) -> Pin<Box<dyn Future<Output = Result<ChainStateView<Self::Context>, ChainError>> + Send + 'async_trait>>
where ChainRuntimeContext<Self>: ExecutionRuntimeContext,
Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn create_chain<'life0, 'async_trait>(
&'life0 self,
committee: Committee,
admin_id: ChainId,
description: ChainDescription,
owner: Owner,
balance: Amount,
timestamp: Timestamp,
) -> 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, 'async_trait>(
&'life0 self,
application_description: &'life1 UserApplicationDescription,
) -> Pin<Box<dyn Future<Output = Result<UserContractCode, ExecutionError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn load_service<'life0, 'life1, 'async_trait>(
&'life0 self,
application_description: &'life1 UserApplicationDescription,
) -> Pin<Box<dyn Future<Output = Result<UserServiceCode, ExecutionError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}
Expand description
Communicate with a persistent storage using the “views” abstraction.
Required Associated Types§
Required Methods§
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.
Other methods that also create ChainStateView
instances that can cause conflicts are:
load_active_chain
and
create_chain
.
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_hashed_confirmed_block<'life0, 'async_trait>(
&'life0 self,
hash: CryptoHash,
) -> Pin<Box<dyn Future<Output = Result<Hashed<ConfirmedBlock>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read_hashed_confirmed_block<'life0, 'async_trait>(
&'life0 self,
hash: CryptoHash,
) -> Pin<Box<dyn Future<Output = Result<Hashed<ConfirmedBlock>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Reads the hashed certificate value with the given hash.
sourcefn read_blob<'life0, 'async_trait>(
&'life0 self,
blob_id: BlobId,
) -> Pin<Box<dyn Future<Output = Result<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<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<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<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<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<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 read_hashed_confirmed_blocks_downward<'life0, 'async_trait>(
&'life0 self,
from: CryptoHash,
limit: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<Hashed<ConfirmedBlock>>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read_hashed_confirmed_blocks_downward<'life0, 'async_trait>(
&'life0 self,
from: CryptoHash,
limit: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<Hashed<ConfirmedBlock>>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Reads the hashed certificate values in descending order from the given hash.
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 write_blob_state<'life0, 'life1, 'async_trait>(
&'life0 self,
blob_id: BlobId,
blob_state: &'life1 BlobState,
) -> Pin<Box<dyn Future<Output = Result<(), ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn write_blob_state<'life0, 'life1, 'async_trait>(
&'life0 self,
blob_id: BlobId,
blob_state: &'life1 BlobState,
) -> Pin<Box<dyn Future<Output = Result<(), ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Writes the given blob state.
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_state<'life0, 'async_trait>(
&'life0 self,
blob_id: BlobId,
blob_state: BlobState,
) -> Pin<Box<dyn Future<Output = Result<Epoch, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn maybe_write_blob_state<'life0, 'async_trait>(
&'life0 self,
blob_id: BlobId,
blob_state: BlobState,
) -> Pin<Box<dyn Future<Output = Result<Epoch, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Attempts to write the given blob state. Returns the latest Epoch
to have used this blob.
sourcefn maybe_write_blob_states<'life0, 'life1, 'async_trait>(
&'life0 self,
blob_ids: &'life1 [BlobId],
blob_state: BlobState,
overwrite: bool,
) -> Pin<Box<dyn Future<Output = Result<Vec<Epoch>, 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,
overwrite: bool,
) -> Pin<Box<dyn Future<Output = Result<Vec<Epoch>, 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<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<ConfirmedBlockCertificate, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Reads the certificate with the given hash.
sourcefn read_certificates<'life0, 'async_trait, I>(
&'life0 self,
hashes: I,
) -> Pin<Box<dyn Future<Output = Result<Vec<ConfirmedBlockCertificate>, ViewError>> + Send + 'async_trait>>where
I: 'async_trait + IntoIterator<Item = CryptoHash> + Send,
Self: 'async_trait,
'life0: 'async_trait,
fn read_certificates<'life0, 'async_trait, I>(
&'life0 self,
hashes: I,
) -> Pin<Box<dyn Future<Output = Result<Vec<ConfirmedBlockCertificate>, ViewError>> + Send + 'async_trait>>where
I: 'async_trait + IntoIterator<Item = CryptoHash> + Send,
Self: 'async_trait,
'life0: 'async_trait,
Reads a number of certificates
sourcefn read_event<'life0, 'async_trait>(
&'life0 self,
id: EventId,
) -> Pin<Box<dyn Future<Output = Result<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<Vec<u8>, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Reads the event with the given ID.
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 wasm_runtime(&self) -> Option<WasmRuntime>
fn wasm_runtime(&self) -> Option<WasmRuntime>
Selects the WebAssembly runtime to use for applications (if any).
Provided Methods§
sourcefn load_active_chain<'life0, 'async_trait>(
&'life0 self,
id: ChainId,
) -> Pin<Box<dyn Future<Output = Result<ChainStateView<Self::Context>, ChainError>> + Send + 'async_trait>>where
ChainRuntimeContext<Self>: ExecutionRuntimeContext,
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn load_active_chain<'life0, 'async_trait>(
&'life0 self,
id: ChainId,
) -> Pin<Box<dyn Future<Output = Result<ChainStateView<Self::Context>, ChainError>> + Send + 'async_trait>>where
ChainRuntimeContext<Self>: ExecutionRuntimeContext,
Self: Sync + 'async_trait,
'life0: 'async_trait,
Loads the view of a chain state and checks that it is active.
§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.
Other methods that also create ChainStateView
instances that can cause conflicts are:
load_chain
and create_chain
.
sourcefn create_chain<'life0, 'async_trait>(
&'life0 self,
committee: Committee,
admin_id: ChainId,
description: ChainDescription,
owner: Owner,
balance: Amount,
timestamp: Timestamp,
) -> 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,
committee: Committee,
admin_id: ChainId,
description: ChainDescription,
owner: Owner,
balance: Amount,
timestamp: Timestamp,
) -> 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.
Other methods that also create ChainStateView
instances that can cause conflicts are:
load_chain
and load_active_chain
.
sourcefn load_contract<'life0, 'life1, 'async_trait>(
&'life0 self,
application_description: &'life1 UserApplicationDescription,
) -> Pin<Box<dyn Future<Output = Result<UserContractCode, ExecutionError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_contract<'life0, 'life1, 'async_trait>(
&'life0 self,
application_description: &'life1 UserApplicationDescription,
) -> Pin<Box<dyn Future<Output = Result<UserContractCode, ExecutionError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Creates a UserContractCode
instance using the bytecode in storage referenced
by the application_description
.
sourcefn load_service<'life0, 'life1, 'async_trait>(
&'life0 self,
application_description: &'life1 UserApplicationDescription,
) -> Pin<Box<dyn Future<Output = Result<UserServiceCode, ExecutionError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_service<'life0, 'life1, 'async_trait>(
&'life0 self,
application_description: &'life1 UserApplicationDescription,
) -> Pin<Box<dyn Future<Output = Result<UserServiceCode, ExecutionError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Creates a [linera-sdk::UserContract
] instance using the bytecode in storage referenced
by the application_description
.