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 contract_balances(
&self,
contract: ContractId,
start_asset: Option<AssetId>,
direction: Option<IterDirection>
) -> impl Iterator<Item = Result<(AssetId, Word), 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.
fn 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
fn 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
fn 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.
fn 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
fn 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.
fn 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.
fn 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.
fn 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.
fn 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.
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.
sourceimpl RelayerDb for Database
impl RelayerDb for Database
sourcefn get_validators<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = HashMap<ValidatorId, (ValidatorStake, Option<ConsensusId>)>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn get_validators<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = HashMap<ValidatorId, (ValidatorStake, Option<ConsensusId>)>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
get validator set for current eth height
sourcefn get_staking_diffs<'life0, 'async_trait>(
&'life0 self,
from_da_height: DaBlockHeight,
to_da_height: Option<DaBlockHeight>
) -> Pin<Box<dyn Future<Output = Vec<(DaBlockHeight, StakingDiff)>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn get_staking_diffs<'life0, 'async_trait>(
&'life0 self,
from_da_height: DaBlockHeight,
to_da_height: Option<DaBlockHeight>
) -> Pin<Box<dyn Future<Output = Vec<(DaBlockHeight, StakingDiff)>> + 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,
da_height: DaBlockHeight,
changes: &'life1 HashMap<ValidatorId, (ValidatorStake, Option<ConsensusId>)>
) -> 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,
da_height: DaBlockHeight,
changes: &'life1 HashMap<ValidatorId, (ValidatorStake, Option<ConsensusId>)>
) -> 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_chain_height<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = BlockHeight> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn get_chain_height<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = BlockHeight> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
current best block number
fn get_sealed_block<'life0, 'async_trait>(
&'life0 self,
_height: BlockHeight
) -> Pin<Box<dyn Future<Output = Option<Arc<SealedFuelBlock>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
sourcefn set_finalized_da_height<'life0, 'async_trait>(
&'life0 self,
block: DaBlockHeight
) -> 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: DaBlockHeight
) -> 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 = DaBlockHeight> + 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 = DaBlockHeight> + 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: DaBlockHeight
) -> 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: DaBlockHeight
) -> 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 = DaBlockHeight> + 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 = DaBlockHeight> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Assume it is allways set as initialization of database.
sourcefn get_last_commited_finalized_fuel_height<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = BlockHeight> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn get_last_commited_finalized_fuel_height<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = BlockHeight> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Until blocks gets commited to da layer it is expected for it to still contains consensus votes and be saved in database until commitment is send to da layer and finalization pariod passes. In case that commited_finalized_fuel_height is zero we need to return genesis block. Read more
sourcefn set_last_commited_finalized_fuel_height<'life0, 'async_trait>(
&'life0 self,
block_height: BlockHeight
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn set_last_commited_finalized_fuel_height<'life0, 'async_trait>(
&'life0 self,
block_height: BlockHeight
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Set last commited finalized fuel height this means we are safe to remove consensus votes from db as from this moment they are not needed any more Read more
sourcefn insert_coin_deposit<'life0, 'async_trait>(
&'life0 mut self,
deposit: DepositCoin
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Self: 'async_trait,
fn insert_coin_deposit<'life0, 'async_trait>(
&'life0 mut self,
deposit: DepositCoin
) -> 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_staking_diff<'life0, 'life1, 'async_trait>(
&'life0 mut self,
da_height: u32,
stakes: &'life1 StakingDiff
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn insert_staking_diff<'life0, 'life1, 'async_trait>(
&'life0 mut self,
da_height: u32,
stakes: &'life1 StakingDiff
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Insert difference make on staking in this particular DA height.
sourcefn get_first_lesser_delegation<'life0, 'life1, 'async_trait>(
&'life0 mut self,
delegate: &'life1 Address,
da_height: u32
) -> Pin<Box<dyn Future<Output = Option<HashMap<Address, u64, RandomState>>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get_first_lesser_delegation<'life0, 'life1, 'async_trait>(
&'life0 mut self,
delegate: &'life1 Address,
da_height: u32
) -> Pin<Box<dyn Future<Output = Option<HashMap<Address, u64, RandomState>>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Query delegate index to find list of blocks that delegation changed iterate over list of indexed to find height that is less but closest to da_height Query that block StakeDiff to find actual delegation change. Read more
fn append_delegate_index<'life0, 'life1, 'async_trait>(
&'life0 mut self,
delegate: &'life1 Address,
da_height: u32
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
sourceimpl Storage<Address, (u64, Option<Bytes32>)> for Database
impl Storage<Address, (u64, Option<Bytes32>)> for Database
type Error = KvStoreError
type Error = KvStoreError
Error implementation of the storage functions
sourcefn insert(
&mut self,
key: &ValidatorId,
value: &(ValidatorStake, Option<ConsensusId>)
) -> Result<Option<(ValidatorStake, Option<ConsensusId>)>, KvStoreError>
fn insert(
&mut self,
key: &ValidatorId,
value: &(ValidatorStake, Option<ConsensusId>)
) -> Result<Option<(ValidatorStake, Option<ConsensusId>)>, KvStoreError>
Append K->V mapping to the storage. Read more
sourcefn remove(
&mut self,
key: &ValidatorId
) -> Result<Option<(ValidatorStake, Option<ConsensusId>)>, KvStoreError>
fn remove(
&mut self,
key: &ValidatorId
) -> Result<Option<(ValidatorStake, Option<ConsensusId>)>, KvStoreError>
Remove K->V mapping from the storage. Read more
sourcefn get(
&self,
key: &ValidatorId
) -> Result<Option<Cow<'_, (ValidatorStake, Option<ConsensusId>)>>, KvStoreError>
fn get(
&self,
key: &ValidatorId
) -> Result<Option<Cow<'_, (ValidatorStake, Option<ConsensusId>)>>, KvStoreError>
Retrieve Cow<V> such as K->V.
sourcefn contains_key(&self, key: &ValidatorId) -> Result<bool, KvStoreError>
fn contains_key(&self, key: &ValidatorId) -> Result<bool, KvStoreError>
Return true if there is a K mapping to a value in the storage.
sourceimpl Storage<Address, Vec<u32, Global>> for Database
impl Storage<Address, Vec<u32, Global>> for Database
Delegate Index maps delegateAddress with list of da block where delegation happened. so that we can access those changes
type Error = KvStoreError
type Error = KvStoreError
Error implementation of the storage functions
sourcefn insert(
&mut self,
key: &Address,
value: &Vec<DaBlockHeight>
) -> Result<Option<Vec<DaBlockHeight>>, KvStoreError>
fn insert(
&mut self,
key: &Address,
value: &Vec<DaBlockHeight>
) -> Result<Option<Vec<DaBlockHeight>>, KvStoreError>
Append K->V mapping to the storage. Read more
sourcefn remove(
&mut self,
key: &Address
) -> Result<Option<Vec<DaBlockHeight>>, KvStoreError>
fn remove(
&mut self,
key: &Address
) -> Result<Option<Vec<DaBlockHeight>>, KvStoreError>
Remove K->V mapping from the storage. Read more
sourcefn get(
&self,
key: &Address
) -> Result<Option<Cow<'_, Vec<DaBlockHeight>>>, KvStoreError>
fn get(
&self,
key: &Address
) -> Result<Option<Cow<'_, Vec<DaBlockHeight>>>, 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<u32, StakingDiff> for Database
impl Storage<u32, StakingDiff> for Database
type Error = KvStoreError
type Error = KvStoreError
Error implementation of the storage functions
sourcefn insert(
&mut self,
key: &DaBlockHeight,
value: &StakingDiff
) -> Result<Option<StakingDiff>, KvStoreError>
fn insert(
&mut self,
key: &DaBlockHeight,
value: &StakingDiff
) -> Result<Option<StakingDiff>, KvStoreError>
Append K->V mapping to the storage. Read more
sourcefn remove(
&mut self,
key: &DaBlockHeight
) -> Result<Option<StakingDiff>, KvStoreError>
fn remove(
&mut self,
key: &DaBlockHeight
) -> Result<Option<StakingDiff>, KvStoreError>
Remove K->V mapping from the storage. Read more
sourcefn get(
&self,
key: &DaBlockHeight
) -> Result<Option<Cow<'_, StakingDiff>>, KvStoreError>
fn get(
&self,
key: &DaBlockHeight
) -> Result<Option<Cow<'_, StakingDiff>>, 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.
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>
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