pub struct Database { /* private fields */ }Implementations
sourceimpl Database
impl Database
pub fn get_block_height(&self) -> Result<Option<BlockHeight>, Error>
pub fn get_block_id(
&self,
height: BlockHeight
) -> Result<Option<Bytes32>, Error>
pub fn all_block_ids(
&self,
start: Option<BlockHeight>,
direction: Option<IterDirection>
) -> impl Iterator<Item = Result<(BlockHeight, Bytes32), Error>> + '_
sourceimpl Database
impl Database
pub fn owned_coins(
&self,
owner: Address,
start_coin: Option<UtxoId>,
direction: Option<IterDirection>
) -> impl Iterator<Item = Result<UtxoId, Error>> + '_
pub fn owned_coins_by_asset_id(
&self,
owner: Address,
asset_id: AssetId,
start_coin: Option<UtxoId>,
direction: Option<IterDirection>
) -> impl Iterator<Item = Result<UtxoId, Error>> + '_
sourceimpl Database
impl Database
pub fn init_chain_name(&self, name: String) -> Result<(), Error>
pub fn get_chain_name(&self) -> Result<Option<String>, Error>
pub fn init_chain_height(&self, height: BlockHeight) -> Result<(), Error>
pub fn get_starting_chain_height(&self) -> Result<Option<BlockHeight>, Error>
sourceimpl Database
impl Database
pub fn all_transactions(
&self,
start: Option<&Bytes32>,
direction: Option<IterDirection>
) -> impl Iterator<Item = Result<Transaction, Error>> + '_
sourcepub fn owned_transactions(
&self,
owner: &Address,
start: Option<&OwnedTransactionIndexCursor>,
direction: Option<IterDirection>
) -> impl Iterator<Item = Result<(OwnedTransactionIndexCursor, Bytes32), Error>> + '_
pub fn owned_transactions(
&self,
owner: &Address,
start: Option<&OwnedTransactionIndexCursor>,
direction: Option<IterDirection>
) -> impl Iterator<Item = Result<(OwnedTransactionIndexCursor, Bytes32), Error>> + '_
Iterates over a KV mapping of [address + block height + tx idx] => transaction id. This
allows for efficient lookup of transaction ids associated with an address, sorted by
block age and ordering within a block. The cursor tracks the [block height + tx idx] for
pagination purposes.
pub fn record_tx_id_owner(
&self,
owner: &Address,
block_height: BlockHeight,
tx_idx: TransactionIndex,
tx_id: &Bytes32
) -> Result<Option<Bytes32>, Error>
pub fn update_tx_status(
&self,
tx_id: &Bytes32,
status: TransactionStatus
) -> Result<Option<TransactionStatus>, Error>
pub fn get_tx_status(
&self,
tx_id: &Bytes32
) -> Result<Option<TransactionStatus>, Error>
Trait Implementations
sourceimpl AsMut<Database> for DatabaseTransaction
impl AsMut<Database> for DatabaseTransaction
sourceimpl AsRef<Database> for DatabaseTransaction
impl AsRef<Database> for DatabaseTransaction
sourceimpl Default for Database
impl Default for Database
Construct an ephemeral database uses rocksdb when rocksdb features are enabled uses in-memory when rocksdb features are disabled
sourceimpl From<&'_ Database> for DatabaseTransaction
impl From<&'_ Database> for DatabaseTransaction
sourceimpl InterpreterStorage for Database
impl InterpreterStorage for Database
sourcefn block_height(&self) -> Result<u32, Error>
fn block_height(&self) -> Result<u32, Error>
Provide the current block height in which the transactions should be executed. Read more
sourcefn block_hash(&self, block_height: u32) -> Result<Bytes32, Error>
fn block_hash(&self, block_height: u32) -> Result<Bytes32, Error>
Provide the block hash from a given height.
sourcefn coinbase(&self) -> Result<Address, Error>
fn coinbase(&self) -> Result<Address, Error>
Provide the coinbase address for the VM instructions implementation.
sourcefn storage_contract(
&self,
id: &ContractId
) -> Result<Option<Cow<'_, Contract>>, Self::DataError>
fn storage_contract(
&self,
id: &ContractId
) -> Result<Option<Cow<'_, Contract>>, Self::DataError>
Fetch a previously inserted contract code from the chain state for a given contract. Read more
sourcefn storage_contract_insert(
&mut self,
id: &ContractId,
contract: &Contract
) -> Result<Option<Contract>, Self::DataError>
fn storage_contract_insert(
&mut self,
id: &ContractId,
contract: &Contract
) -> Result<Option<Contract>, Self::DataError>
Append a contract to the chain, provided its identifier. Read more
sourcefn storage_contract_exists(
&self,
id: &ContractId
) -> Result<bool, Self::DataError>
fn storage_contract_exists(
&self,
id: &ContractId
) -> Result<bool, Self::DataError>
Check if a provided contract exists in the chain.
sourcefn storage_contract_root(
&self,
id: &ContractId
) -> Result<Option<Cow<'_, (Salt, Bytes32)>>, Self::DataError>
fn storage_contract_root(
&self,
id: &ContractId
) -> Result<Option<Cow<'_, (Salt, Bytes32)>>, Self::DataError>
Fetch a previously inserted salt+root tuple from the chain state for a given contract. Read more
sourcefn storage_contract_root_insert(
&mut self,
id: &ContractId,
salt: &Salt,
root: &Bytes32
) -> Result<Option<(Salt, Bytes32)>, Self::DataError>
fn storage_contract_root_insert(
&mut self,
id: &ContractId,
salt: &Salt,
root: &Bytes32
) -> Result<Option<(Salt, Bytes32)>, Self::DataError>
Append the salt+root of a contract that was appended to the chain.
sourcefn merkle_contract_state(
&self,
id: &ContractId,
key: &Bytes32
) -> Result<Option<Cow<'_, Bytes32>>, Self::DataError>
fn merkle_contract_state(
&self,
id: &ContractId,
key: &Bytes32
) -> Result<Option<Cow<'_, Bytes32>>, Self::DataError>
Fetch the value form a key-value mapping in a contract storage.
sourcefn merkle_contract_state_insert(
&mut self,
contract: &ContractId,
key: &Bytes32,
value: &Bytes32
) -> Result<Option<Bytes32>, Self::DataError>
fn merkle_contract_state_insert(
&mut self,
contract: &ContractId,
key: &Bytes32,
value: &Bytes32
) -> Result<Option<Bytes32>, Self::DataError>
Insert a key-value mapping in a contract storage.
sourcefn merkle_contract_asset_id_balance(
&self,
id: &ContractId,
asset_id: &AssetId
) -> Result<Option<u64>, Self::DataError>
fn merkle_contract_asset_id_balance(
&self,
id: &ContractId,
asset_id: &AssetId
) -> Result<Option<u64>, Self::DataError>
Fetch the balance of an asset ID in a contract storage.
sourcefn merkle_contract_asset_id_balance_insert(
&mut self,
contract: &ContractId,
asset_id: &AssetId,
value: u64
) -> Result<Option<u64>, Self::DataError>
fn merkle_contract_asset_id_balance_insert(
&mut self,
contract: &ContractId,
asset_id: &AssetId,
value: u64
) -> Result<Option<u64>, Self::DataError>
Update the balance of an asset ID in a contract storage.
sourceimpl MerkleStorage<ContractId, AssetId, u64> for Database
impl MerkleStorage<ContractId, AssetId, u64> for Database
sourcefn insert(
&mut self,
parent: &ContractId,
key: &AssetId,
value: &Word
) -> Result<Option<Word>, Error>
fn insert(
&mut self,
parent: &ContractId,
key: &AssetId,
value: &Word
) -> Result<Option<Word>, Error>
Append P->K->V mapping to the storage. Read more
sourcefn remove(
&mut self,
parent: &ContractId,
key: &AssetId
) -> Result<Option<Word>, Error>
fn remove(
&mut self,
parent: &ContractId,
key: &AssetId
) -> Result<Option<Word>, Error>
Remove P->K->V mapping from the storage. Read more
sourcefn get(
&self,
parent: &ContractId,
key: &AssetId
) -> Result<Option<Cow<'_, Word>>, Error>
fn get(
&self,
parent: &ContractId,
key: &AssetId
) -> Result<Option<Cow<'_, Word>>, Error>
Retrieve Cow<V> such as P->K->V.
sourcefn contains_key(
&self,
parent: &ContractId,
key: &AssetId
) -> Result<bool, Error>
fn contains_key(
&self,
parent: &ContractId,
key: &AssetId
) -> Result<bool, Error>
Return true if there is a P->K mapping to a value in the storage.
sourcefn root(&mut self, parent: &ContractId) -> Result<MerkleRoot, Error>
fn root(&mut self, parent: &ContractId) -> Result<MerkleRoot, Error>
Return the merkle root of the domain of P. Read more
sourceimpl MerkleStorage<ContractId, Bytes32, Bytes32> for Database
impl MerkleStorage<ContractId, Bytes32, Bytes32> for Database
sourcefn insert(
&mut self,
parent: &ContractId,
key: &Bytes32,
value: &Bytes32
) -> Result<Option<Bytes32>, Error>
fn insert(
&mut self,
parent: &ContractId,
key: &Bytes32,
value: &Bytes32
) -> Result<Option<Bytes32>, Error>
Append P->K->V mapping to the storage. Read more
sourcefn remove(
&mut self,
parent: &ContractId,
key: &Bytes32
) -> Result<Option<Bytes32>, Error>
fn remove(
&mut self,
parent: &ContractId,
key: &Bytes32
) -> Result<Option<Bytes32>, Error>
Remove P->K->V mapping from the storage. Read more
sourcefn get(
&self,
parent: &ContractId,
key: &Bytes32
) -> Result<Option<Cow<'_, Bytes32>>, Error>
fn get(
&self,
parent: &ContractId,
key: &Bytes32
) -> Result<Option<Cow<'_, Bytes32>>, Error>
Retrieve Cow<V> such as P->K->V.
sourcefn contains_key(
&self,
parent: &ContractId,
key: &Bytes32
) -> Result<bool, Error>
fn contains_key(
&self,
parent: &ContractId,
key: &Bytes32
) -> Result<bool, Error>
Return true if there is a P->K mapping to a value in the storage.
sourcefn root(&mut self, parent: &ContractId) -> Result<MerkleRoot, Error>
fn root(&mut self, parent: &ContractId) -> Result<MerkleRoot, Error>
Return the merkle root of the domain of P. Read more
sourceimpl RelayerDb for Database
impl RelayerDb for Database
sourcefn get_validators<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = HashMap<Address, u64>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn get_validators<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = HashMap<Address, u64>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
get validator set for current eth height
sourcefn get_validator_diffs<'life0, 'async_trait>(
&'life0 self,
from_da_height: u64,
to_da_height: Option<u64>
) -> Pin<Box<dyn Future<Output = Vec<(u64, HashMap<Address, u64>)>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn get_validator_diffs<'life0, 'async_trait>(
&'life0 self,
from_da_height: u64,
to_da_height: Option<u64>
) -> Pin<Box<dyn Future<Output = Vec<(u64, HashMap<Address, u64>)>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
get stakes difference between fuel blocks. Return vector of changed (some blocks are not going to have any change)
sourcefn apply_validator_diffs<'life0, 'life1, 'async_trait>(
&'life0 mut self,
changes: &'life1 HashMap<Address, u64>,
da_height: u64
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn apply_validator_diffs<'life0, 'life1, 'async_trait>(
&'life0 mut self,
changes: &'life1 HashMap<Address, u64>,
da_height: u64
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Apply validators diff to validator set and update validators_da_height. This operation needs to be atomic. Read more
sourcefn get_block_height<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = u64> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn get_block_height<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = u64> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
current best block number
sourcefn set_finalized_da_height<'life0, 'async_trait>(
&'life0 self,
block: u64
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn set_finalized_da_height<'life0, 'async_trait>(
&'life0 self,
block: u64
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
set finalized da height that represent last block from da layer that got finalized.
sourcefn get_finalized_da_height<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = u64> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn get_finalized_da_height<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = u64> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Assume it is allways set as initialization of database.
sourcefn set_validators_da_height<'life0, 'async_trait>(
&'life0 self,
block: u64
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn set_validators_da_height<'life0, 'async_trait>(
&'life0 self,
block: u64
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Set data availability block height that corresponds to current_validator_set
sourcefn get_validators_da_height<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = u64> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn get_validators_da_height<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = u64> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Assume it is allways set as initialization of database.
sourcefn insert_token_deposit<'life0, 'async_trait>(
&'life0 mut self,
deposit_nonce: Bytes32,
deposited_da_height: u64,
owner: Address,
asset_id: AssetId,
amount: u64
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Self: 'async_trait,
fn insert_token_deposit<'life0, 'async_trait>(
&'life0 mut self,
deposit_nonce: Bytes32,
deposited_da_height: u64,
owner: Address,
asset_id: AssetId,
amount: u64
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Self: 'async_trait,
deposit token to database. Token deposits are not revertable
sourcefn insert_validators_diff<'life0, 'life1, 'async_trait>(
&'life0 mut self,
da_height: u64,
stakes: &'life1 HashMap<Address, u64, RandomState>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn insert_validators_diff<'life0, 'life1, 'async_trait>(
&'life0 mut self,
da_height: u64,
stakes: &'life1 HashMap<Address, u64, RandomState>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Asumption is that validator state is already checked in da side, and we can blidly apply changed to db without checking if we have enought stake to reduce. What needs to be done is to have validator set state and diff as separate database values. Read more
sourceimpl Storage<Address, u64> for Database
impl Storage<Address, u64> for Database
type Error = KvStoreError
type Error = KvStoreError
Error implementation of the storage functions
sourcefn insert(
&mut self,
key: &Address,
value: &u64
) -> Result<Option<u64>, KvStoreError>
fn insert(
&mut self,
key: &Address,
value: &u64
) -> Result<Option<u64>, KvStoreError>
Append K->V mapping to the storage. Read more
sourcefn remove(&mut self, key: &Address) -> Result<Option<u64>, KvStoreError>
fn remove(&mut self, key: &Address) -> Result<Option<u64>, KvStoreError>
Remove K->V mapping from the storage. Read more
sourcefn get(&self, key: &Address) -> Result<Option<Cow<'_, u64>>, KvStoreError>
fn get(&self, key: &Address) -> Result<Option<Cow<'_, u64>>, KvStoreError>
Retrieve Cow<V> such as K->V.
sourcefn contains_key(&self, key: &Address) -> Result<bool, KvStoreError>
fn contains_key(&self, key: &Address) -> Result<bool, KvStoreError>
Return true if there is a K mapping to a value in the storage.
sourceimpl Storage<Bytes32, DepositCoin> for Database
impl Storage<Bytes32, DepositCoin> for Database
type Error = KvStoreError
type Error = KvStoreError
Error implementation of the storage functions
sourcefn insert(
&mut self,
key: &Bytes32,
value: &DepositCoin
) -> Result<Option<DepositCoin>, KvStoreError>
fn insert(
&mut self,
key: &Bytes32,
value: &DepositCoin
) -> Result<Option<DepositCoin>, KvStoreError>
Append K->V mapping to the storage. Read more
sourcefn remove(&mut self, key: &Bytes32) -> Result<Option<DepositCoin>, KvStoreError>
fn remove(&mut self, key: &Bytes32) -> Result<Option<DepositCoin>, KvStoreError>
Remove K->V mapping from the storage. Read more
sourcefn get(
&self,
key: &Bytes32
) -> Result<Option<Cow<'_, DepositCoin>>, KvStoreError>
fn get(
&self,
key: &Bytes32
) -> Result<Option<Cow<'_, DepositCoin>>, KvStoreError>
Retrieve Cow<V> such as K->V.
sourcefn contains_key(&self, key: &Bytes32) -> Result<bool, KvStoreError>
fn contains_key(&self, key: &Bytes32) -> Result<bool, KvStoreError>
Return true if there is a K mapping to a value in the storage.
sourceimpl Storage<Bytes32, FuelBlockDb> for Database
impl Storage<Bytes32, FuelBlockDb> for Database
type Error = KvStoreError
type Error = KvStoreError
Error implementation of the storage functions
sourcefn insert(
&mut self,
key: &Bytes32,
value: &FuelBlockDb
) -> Result<Option<FuelBlockDb>, KvStoreError>
fn insert(
&mut self,
key: &Bytes32,
value: &FuelBlockDb
) -> Result<Option<FuelBlockDb>, KvStoreError>
Append K->V mapping to the storage. Read more
sourcefn remove(&mut self, key: &Bytes32) -> Result<Option<FuelBlockDb>, KvStoreError>
fn remove(&mut self, key: &Bytes32) -> Result<Option<FuelBlockDb>, KvStoreError>
Remove K->V mapping from the storage. Read more
sourcefn get(
&self,
key: &Bytes32
) -> Result<Option<Cow<'_, FuelBlockDb>>, KvStoreError>
fn get(
&self,
key: &Bytes32
) -> Result<Option<Cow<'_, FuelBlockDb>>, KvStoreError>
Retrieve Cow<V> such as K->V.
sourcefn contains_key(&self, key: &Bytes32) -> Result<bool, KvStoreError>
fn contains_key(&self, key: &Bytes32) -> Result<bool, KvStoreError>
Return true if there is a K mapping to a value in the storage.
sourceimpl Storage<Bytes32, Transaction> for Database
impl Storage<Bytes32, Transaction> for Database
type Error = KvStoreError
type Error = KvStoreError
Error implementation of the storage functions
sourcefn insert(
&mut self,
key: &Bytes32,
value: &Transaction
) -> Result<Option<Transaction>, KvStoreError>
fn insert(
&mut self,
key: &Bytes32,
value: &Transaction
) -> Result<Option<Transaction>, KvStoreError>
Append K->V mapping to the storage. Read more
sourcefn remove(&mut self, key: &Bytes32) -> Result<Option<Transaction>, KvStoreError>
fn remove(&mut self, key: &Bytes32) -> Result<Option<Transaction>, KvStoreError>
Remove K->V mapping from the storage. Read more
sourcefn get(
&self,
key: &Bytes32
) -> Result<Option<Cow<'_, Transaction>>, KvStoreError>
fn get(
&self,
key: &Bytes32
) -> Result<Option<Cow<'_, Transaction>>, KvStoreError>
Retrieve Cow<V> such as K->V.
sourcefn contains_key(&self, key: &Bytes32) -> Result<bool, KvStoreError>
fn contains_key(&self, key: &Bytes32) -> Result<bool, KvStoreError>
Return true if there is a K mapping to a value in the storage.
sourceimpl Storage<Bytes32, Vec<Receipt, Global>> for Database
impl Storage<Bytes32, Vec<Receipt, Global>> for Database
type Error = KvStoreError
type Error = KvStoreError
Error implementation of the storage functions
sourcefn insert(
&mut self,
key: &Bytes32,
value: &Vec<Receipt>
) -> Result<Option<Vec<Receipt>>, KvStoreError>
fn insert(
&mut self,
key: &Bytes32,
value: &Vec<Receipt>
) -> Result<Option<Vec<Receipt>>, KvStoreError>
Append K->V mapping to the storage. Read more
sourcefn remove(
&mut self,
key: &Bytes32
) -> Result<Option<Vec<Receipt>>, KvStoreError>
fn remove(
&mut self,
key: &Bytes32
) -> Result<Option<Vec<Receipt>>, KvStoreError>
Remove K->V mapping from the storage. Read more
sourcefn get(
&self,
key: &Bytes32
) -> Result<Option<Cow<'_, Vec<Receipt>>>, KvStoreError>
fn get(
&self,
key: &Bytes32
) -> Result<Option<Cow<'_, Vec<Receipt>>>, KvStoreError>
Retrieve Cow<V> such as K->V.
sourcefn contains_key(&self, key: &Bytes32) -> Result<bool, KvStoreError>
fn contains_key(&self, key: &Bytes32) -> Result<bool, KvStoreError>
Return true if there is a K mapping to a value in the storage.
sourceimpl Storage<ContractId, (Salt, Bytes32)> for Database
impl Storage<ContractId, (Salt, Bytes32)> for Database
sourcefn insert(
&mut self,
key: &ContractId,
value: &(Salt, Bytes32)
) -> Result<Option<(Salt, Bytes32)>, Error>
fn insert(
&mut self,
key: &ContractId,
value: &(Salt, Bytes32)
) -> Result<Option<(Salt, Bytes32)>, Error>
Append K->V mapping to the storage. Read more
sourcefn remove(&mut self, key: &ContractId) -> Result<Option<(Salt, Bytes32)>, Error>
fn remove(&mut self, key: &ContractId) -> Result<Option<(Salt, Bytes32)>, Error>
Remove K->V mapping from the storage. Read more
sourcefn get(
&self,
key: &ContractId
) -> Result<Option<Cow<'_, (Salt, Bytes32)>>, Error>
fn get(
&self,
key: &ContractId
) -> Result<Option<Cow<'_, (Salt, Bytes32)>>, Error>
Retrieve Cow<V> such as K->V.
sourcefn contains_key(&self, key: &ContractId) -> Result<bool, Error>
fn contains_key(&self, key: &ContractId) -> Result<bool, Error>
Return true if there is a K mapping to a value in the storage.
sourceimpl Storage<ContractId, Contract> for Database
impl Storage<ContractId, Contract> for Database
sourcefn insert(
&mut self,
key: &ContractId,
value: &Contract
) -> Result<Option<Contract>, Error>
fn insert(
&mut self,
key: &ContractId,
value: &Contract
) -> Result<Option<Contract>, Error>
Append K->V mapping to the storage. Read more
sourcefn remove(&mut self, key: &ContractId) -> Result<Option<Contract>, Error>
fn remove(&mut self, key: &ContractId) -> Result<Option<Contract>, Error>
Remove K->V mapping from the storage. Read more
sourcefn get(&self, key: &ContractId) -> Result<Option<Cow<'_, Contract>>, Error>
fn get(&self, key: &ContractId) -> Result<Option<Cow<'_, Contract>>, Error>
Retrieve Cow<V> such as K->V.
sourcefn contains_key(&self, key: &ContractId) -> Result<bool, Error>
fn contains_key(&self, key: &ContractId) -> Result<bool, Error>
Return true if there is a K mapping to a value in the storage.
sourceimpl Storage<ContractId, UtxoId> for Database
impl Storage<ContractId, UtxoId> for Database
sourcefn insert(
&mut self,
key: &ContractId,
value: &UtxoId
) -> Result<Option<UtxoId>, Self::Error>
fn insert(
&mut self,
key: &ContractId,
value: &UtxoId
) -> Result<Option<UtxoId>, Self::Error>
Append K->V mapping to the storage. Read more
sourcefn remove(&mut self, key: &ContractId) -> Result<Option<UtxoId>, Self::Error>
fn remove(&mut self, key: &ContractId) -> Result<Option<UtxoId>, Self::Error>
Remove K->V mapping from the storage. Read more
sourcefn get<'a>(
&'a self,
key: &ContractId
) -> Result<Option<Cow<'a, UtxoId>>, Self::Error>
fn get<'a>(
&'a self,
key: &ContractId
) -> Result<Option<Cow<'a, UtxoId>>, Self::Error>
Retrieve Cow<V> such as K->V.
sourcefn contains_key(&self, key: &ContractId) -> Result<bool, Self::Error>
fn contains_key(&self, key: &ContractId) -> Result<bool, Self::Error>
Return true if there is a K mapping to a value in the storage.
sourceimpl Storage<UtxoId, Coin> for Database
impl Storage<UtxoId, Coin> for Database
type Error = KvStoreError
type Error = KvStoreError
Error implementation of the storage functions
sourcefn insert(
&mut self,
key: &UtxoId,
value: &Coin
) -> Result<Option<Coin>, KvStoreError>
fn insert(
&mut self,
key: &UtxoId,
value: &Coin
) -> Result<Option<Coin>, KvStoreError>
Append K->V mapping to the storage. Read more
sourcefn remove(&mut self, key: &UtxoId) -> Result<Option<Coin>, KvStoreError>
fn remove(&mut self, key: &UtxoId) -> Result<Option<Coin>, KvStoreError>
Remove K->V mapping from the storage. Read more
sourcefn get(&self, key: &UtxoId) -> Result<Option<Cow<'_, Coin>>, KvStoreError>
fn get(&self, key: &UtxoId) -> Result<Option<Cow<'_, Coin>>, KvStoreError>
Retrieve Cow<V> such as K->V.
sourcefn contains_key(&self, key: &UtxoId) -> Result<bool, KvStoreError>
fn contains_key(&self, key: &UtxoId) -> Result<bool, KvStoreError>
Return true if there is a K mapping to a value in the storage.
sourceimpl Storage<u64, HashMap<Address, u64, RandomState>> for Database
impl Storage<u64, HashMap<Address, u64, RandomState>> for Database
type Error = KvStoreError
type Error = KvStoreError
Error implementation of the storage functions
sourcefn insert(
&mut self,
key: &DaBlockHeight,
value: &HashMap<Address, u64>
) -> Result<Option<HashMap<Address, u64>>, KvStoreError>
fn insert(
&mut self,
key: &DaBlockHeight,
value: &HashMap<Address, u64>
) -> Result<Option<HashMap<Address, u64>>, KvStoreError>
Append K->V mapping to the storage. Read more
sourcefn remove(
&mut self,
key: &DaBlockHeight
) -> Result<Option<HashMap<Address, u64>>, KvStoreError>
fn remove(
&mut self,
key: &DaBlockHeight
) -> Result<Option<HashMap<Address, u64>>, KvStoreError>
Remove K->V mapping from the storage. Read more
sourcefn get(
&self,
key: &DaBlockHeight
) -> Result<Option<Cow<'_, HashMap<Address, u64>>>, KvStoreError>
fn get(
&self,
key: &DaBlockHeight
) -> Result<Option<Cow<'_, HashMap<Address, u64>>>, KvStoreError>
Retrieve Cow<V> such as K->V.
sourcefn contains_key(&self, key: &DaBlockHeight) -> Result<bool, KvStoreError>
fn contains_key(&self, key: &DaBlockHeight) -> Result<bool, KvStoreError>
Return true if there is a K mapping to a value in the storage.
sourceimpl TxPoolDb for Database
impl TxPoolDb for Database
fn utxo(&self, utxo_id: &UtxoId) -> Result<Option<Coin>, KvStoreError>
fn contract_exist(&self, contract_id: ContractId) -> Result<bool, Error>
impl Send for Database
impl Sync for Database
Auto Trait Implementations
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more