Trait linera_execution::BaseRuntime
source · pub trait BaseRuntime {
type Read: Debug + Send + Sync;
type ContainsKey: Debug + Send + Sync;
type ContainsKeys: Debug + Send + Sync;
type ReadMultiValuesBytes: Debug + Send + Sync;
type ReadValueBytes: Debug + Send + Sync;
type FindKeysByPrefix: Debug + Send + Sync;
type FindKeyValuesByPrefix: Debug + Send + Sync;
Show 32 methods
// Required methods
fn chain_id(&mut self) -> Result<ChainId, ExecutionError>;
fn block_height(&mut self) -> Result<BlockHeight, ExecutionError>;
fn application_id(&mut self) -> Result<UserApplicationId, ExecutionError>;
fn application_creator_chain_id(
&mut self,
) -> Result<ChainId, ExecutionError>;
fn application_parameters(&mut self) -> Result<Vec<u8>, ExecutionError>;
fn read_system_timestamp(&mut self) -> Result<Timestamp, ExecutionError>;
fn read_chain_balance(&mut self) -> Result<Amount, ExecutionError>;
fn read_owner_balance(
&mut self,
owner: AccountOwner,
) -> Result<Amount, ExecutionError>;
fn read_owner_balances(
&mut self,
) -> Result<Vec<(AccountOwner, Amount)>, ExecutionError>;
fn read_balance_owners(
&mut self,
) -> Result<Vec<AccountOwner>, ExecutionError>;
fn chain_ownership(&mut self) -> Result<ChainOwnership, ExecutionError>;
fn contains_key_new(
&mut self,
key: Vec<u8>,
) -> Result<Self::ContainsKey, ExecutionError>;
fn contains_key_wait(
&mut self,
promise: &Self::ContainsKey,
) -> Result<bool, ExecutionError>;
fn contains_keys_new(
&mut self,
keys: Vec<Vec<u8>>,
) -> Result<Self::ContainsKeys, ExecutionError>;
fn contains_keys_wait(
&mut self,
promise: &Self::ContainsKeys,
) -> Result<Vec<bool>, ExecutionError>;
fn read_multi_values_bytes_new(
&mut self,
keys: Vec<Vec<u8>>,
) -> Result<Self::ReadMultiValuesBytes, ExecutionError>;
fn read_multi_values_bytes_wait(
&mut self,
promise: &Self::ReadMultiValuesBytes,
) -> Result<Vec<Option<Vec<u8>>>, ExecutionError>;
fn read_value_bytes_new(
&mut self,
key: Vec<u8>,
) -> Result<Self::ReadValueBytes, ExecutionError>;
fn read_value_bytes_wait(
&mut self,
promise: &Self::ReadValueBytes,
) -> Result<Option<Vec<u8>>, ExecutionError>;
fn find_keys_by_prefix_new(
&mut self,
key_prefix: Vec<u8>,
) -> Result<Self::FindKeysByPrefix, ExecutionError>;
fn find_keys_by_prefix_wait(
&mut self,
promise: &Self::FindKeysByPrefix,
) -> Result<Vec<Vec<u8>>, ExecutionError>;
fn find_key_values_by_prefix_new(
&mut self,
key_prefix: Vec<u8>,
) -> Result<Self::FindKeyValuesByPrefix, ExecutionError>;
fn find_key_values_by_prefix_wait(
&mut self,
promise: &Self::FindKeyValuesByPrefix,
) -> Result<Vec<(Vec<u8>, Vec<u8>)>, ExecutionError>;
fn perform_http_request(
&mut self,
request: Request,
) -> Result<Response, ExecutionError>;
fn assert_before(
&mut self,
timestamp: Timestamp,
) -> Result<(), ExecutionError>;
fn read_data_blob(
&mut self,
hash: &CryptoHash,
) -> Result<Vec<u8>, ExecutionError>;
fn assert_data_blob_exists(
&mut self,
hash: &CryptoHash,
) -> Result<(), ExecutionError>;
// Provided methods
fn contains_key(&mut self, key: Vec<u8>) -> Result<bool, ExecutionError> { ... }
fn contains_keys(
&mut self,
keys: Vec<Vec<u8>>,
) -> Result<Vec<bool>, ExecutionError> { ... }
fn read_multi_values_bytes(
&mut self,
keys: Vec<Vec<u8>>,
) -> Result<Vec<Option<Vec<u8>>>, ExecutionError> { ... }
fn read_value_bytes(
&mut self,
key: Vec<u8>,
) -> Result<Option<Vec<u8>>, ExecutionError> { ... }
fn find_key_values_by_prefix(
&mut self,
key_prefix: Vec<u8>,
) -> Result<Vec<(Vec<u8>, Vec<u8>)>, ExecutionError> { ... }
}
Required Associated Types§
type Read: Debug + Send + Sync
type ContainsKey: Debug + Send + Sync
type ContainsKeys: Debug + Send + Sync
type ReadMultiValuesBytes: Debug + Send + Sync
type ReadValueBytes: Debug + Send + Sync
type FindKeysByPrefix: Debug + Send + Sync
type FindKeyValuesByPrefix: Debug + Send + Sync
Required Methods§
sourcefn chain_id(&mut self) -> Result<ChainId, ExecutionError>
fn chain_id(&mut self) -> Result<ChainId, ExecutionError>
The current chain ID.
sourcefn block_height(&mut self) -> Result<BlockHeight, ExecutionError>
fn block_height(&mut self) -> Result<BlockHeight, ExecutionError>
The current block height.
sourcefn application_id(&mut self) -> Result<UserApplicationId, ExecutionError>
fn application_id(&mut self) -> Result<UserApplicationId, ExecutionError>
The current application ID.
sourcefn application_creator_chain_id(&mut self) -> Result<ChainId, ExecutionError>
fn application_creator_chain_id(&mut self) -> Result<ChainId, ExecutionError>
The current application creator’s chain ID.
sourcefn application_parameters(&mut self) -> Result<Vec<u8>, ExecutionError>
fn application_parameters(&mut self) -> Result<Vec<u8>, ExecutionError>
The current application parameters.
sourcefn read_system_timestamp(&mut self) -> Result<Timestamp, ExecutionError>
fn read_system_timestamp(&mut self) -> Result<Timestamp, ExecutionError>
Reads the system timestamp.
sourcefn read_chain_balance(&mut self) -> Result<Amount, ExecutionError>
fn read_chain_balance(&mut self) -> Result<Amount, ExecutionError>
Reads the balance of the chain.
sourcefn read_owner_balance(
&mut self,
owner: AccountOwner,
) -> Result<Amount, ExecutionError>
fn read_owner_balance( &mut self, owner: AccountOwner, ) -> Result<Amount, ExecutionError>
Reads the owner balance.
sourcefn read_owner_balances(
&mut self,
) -> Result<Vec<(AccountOwner, Amount)>, ExecutionError>
fn read_owner_balances( &mut self, ) -> Result<Vec<(AccountOwner, Amount)>, ExecutionError>
Reads the balances from all owners.
sourcefn read_balance_owners(&mut self) -> Result<Vec<AccountOwner>, ExecutionError>
fn read_balance_owners(&mut self) -> Result<Vec<AccountOwner>, ExecutionError>
Reads balance owners.
sourcefn chain_ownership(&mut self) -> Result<ChainOwnership, ExecutionError>
fn chain_ownership(&mut self) -> Result<ChainOwnership, ExecutionError>
Reads the current ownership configuration for this chain.
sourcefn contains_key_new(
&mut self,
key: Vec<u8>,
) -> Result<Self::ContainsKey, ExecutionError>
fn contains_key_new( &mut self, key: Vec<u8>, ) -> Result<Self::ContainsKey, ExecutionError>
Creates the promise to test whether a key exists in the key-value store
sourcefn contains_key_wait(
&mut self,
promise: &Self::ContainsKey,
) -> Result<bool, ExecutionError>
fn contains_key_wait( &mut self, promise: &Self::ContainsKey, ) -> Result<bool, ExecutionError>
Resolves the promise to test whether a key exists in the key-value store
sourcefn contains_keys_new(
&mut self,
keys: Vec<Vec<u8>>,
) -> Result<Self::ContainsKeys, ExecutionError>
fn contains_keys_new( &mut self, keys: Vec<Vec<u8>>, ) -> Result<Self::ContainsKeys, ExecutionError>
Creates the promise to test whether multiple keys exist in the key-value store
sourcefn contains_keys_wait(
&mut self,
promise: &Self::ContainsKeys,
) -> Result<Vec<bool>, ExecutionError>
fn contains_keys_wait( &mut self, promise: &Self::ContainsKeys, ) -> Result<Vec<bool>, ExecutionError>
Resolves the promise to test whether multiple keys exist in the key-value store
sourcefn read_multi_values_bytes_new(
&mut self,
keys: Vec<Vec<u8>>,
) -> Result<Self::ReadMultiValuesBytes, ExecutionError>
fn read_multi_values_bytes_new( &mut self, keys: Vec<Vec<u8>>, ) -> Result<Self::ReadMultiValuesBytes, ExecutionError>
Creates the promise to access several keys from the key-value store
sourcefn read_multi_values_bytes_wait(
&mut self,
promise: &Self::ReadMultiValuesBytes,
) -> Result<Vec<Option<Vec<u8>>>, ExecutionError>
fn read_multi_values_bytes_wait( &mut self, promise: &Self::ReadMultiValuesBytes, ) -> Result<Vec<Option<Vec<u8>>>, ExecutionError>
Resolves the promise to access several keys from the key-value store
sourcefn read_value_bytes_new(
&mut self,
key: Vec<u8>,
) -> Result<Self::ReadValueBytes, ExecutionError>
fn read_value_bytes_new( &mut self, key: Vec<u8>, ) -> Result<Self::ReadValueBytes, ExecutionError>
Creates the promise to access a key from the key-value store
sourcefn read_value_bytes_wait(
&mut self,
promise: &Self::ReadValueBytes,
) -> Result<Option<Vec<u8>>, ExecutionError>
fn read_value_bytes_wait( &mut self, promise: &Self::ReadValueBytes, ) -> Result<Option<Vec<u8>>, ExecutionError>
Resolves the promise to access a key from the key-value store
sourcefn find_keys_by_prefix_new(
&mut self,
key_prefix: Vec<u8>,
) -> Result<Self::FindKeysByPrefix, ExecutionError>
fn find_keys_by_prefix_new( &mut self, key_prefix: Vec<u8>, ) -> Result<Self::FindKeysByPrefix, ExecutionError>
Creates the promise to access keys having a specific prefix
sourcefn find_keys_by_prefix_wait(
&mut self,
promise: &Self::FindKeysByPrefix,
) -> Result<Vec<Vec<u8>>, ExecutionError>
fn find_keys_by_prefix_wait( &mut self, promise: &Self::FindKeysByPrefix, ) -> Result<Vec<Vec<u8>>, ExecutionError>
Resolves the promise to access keys having a specific prefix
sourcefn find_key_values_by_prefix_new(
&mut self,
key_prefix: Vec<u8>,
) -> Result<Self::FindKeyValuesByPrefix, ExecutionError>
fn find_key_values_by_prefix_new( &mut self, key_prefix: Vec<u8>, ) -> Result<Self::FindKeyValuesByPrefix, ExecutionError>
Creates the promise to access key/values having a specific prefix
sourcefn find_key_values_by_prefix_wait(
&mut self,
promise: &Self::FindKeyValuesByPrefix,
) -> Result<Vec<(Vec<u8>, Vec<u8>)>, ExecutionError>
fn find_key_values_by_prefix_wait( &mut self, promise: &Self::FindKeyValuesByPrefix, ) -> Result<Vec<(Vec<u8>, Vec<u8>)>, ExecutionError>
Resolves the promise to access key/values having a specific prefix
sourcefn perform_http_request(
&mut self,
request: Request,
) -> Result<Response, ExecutionError>
fn perform_http_request( &mut self, request: Request, ) -> Result<Response, ExecutionError>
Makes an HTTP request to the given URL and returns the answer, if any.
sourcefn assert_before(&mut self, timestamp: Timestamp) -> Result<(), ExecutionError>
fn assert_before(&mut self, timestamp: Timestamp) -> Result<(), ExecutionError>
Ensures that the current time at block validation is < timestamp
. Note that block
validation happens at or after the block timestamp, but isn’t necessarily the same.
Cannot be used in fast blocks: A block using this call should be proposed by a regular owner, not a super owner.
sourcefn read_data_blob(
&mut self,
hash: &CryptoHash,
) -> Result<Vec<u8>, ExecutionError>
fn read_data_blob( &mut self, hash: &CryptoHash, ) -> Result<Vec<u8>, ExecutionError>
Reads a data blob specified by a given hash.
sourcefn assert_data_blob_exists(
&mut self,
hash: &CryptoHash,
) -> Result<(), ExecutionError>
fn assert_data_blob_exists( &mut self, hash: &CryptoHash, ) -> Result<(), ExecutionError>
Asserts the existence of a data blob with the given hash.
Provided Methods§
sourcefn contains_key(&mut self, key: Vec<u8>) -> Result<bool, ExecutionError>
fn contains_key(&mut self, key: Vec<u8>) -> Result<bool, ExecutionError>
Tests whether a key exists in the key-value store
sourcefn contains_keys(
&mut self,
keys: Vec<Vec<u8>>,
) -> Result<Vec<bool>, ExecutionError>
fn contains_keys( &mut self, keys: Vec<Vec<u8>>, ) -> Result<Vec<bool>, ExecutionError>
Tests whether multiple keys exist in the key-value store
sourcefn read_multi_values_bytes(
&mut self,
keys: Vec<Vec<u8>>,
) -> Result<Vec<Option<Vec<u8>>>, ExecutionError>
fn read_multi_values_bytes( &mut self, keys: Vec<Vec<u8>>, ) -> Result<Vec<Option<Vec<u8>>>, ExecutionError>
Reads several keys from the key-value store
sourcefn read_value_bytes(
&mut self,
key: Vec<u8>,
) -> Result<Option<Vec<u8>>, ExecutionError>
fn read_value_bytes( &mut self, key: Vec<u8>, ) -> Result<Option<Vec<u8>>, ExecutionError>
Reads the key from the key-value store