pub struct Database { /* private fields */ }
Implementations
pub fn all_block_ids(
&self,
start: Option<BlockHeight>,
direction: Option<IterDirection>
) -> impl Iterator<Item = Result<(BlockHeight, Bytes32), Error>> + '_
pub fn all_transactions(
&self,
start: Option<&Bytes32>,
direction: Option<IterDirection>
) -> impl Iterator<Item = Result<Transaction, Error>> + '_
pub 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>
Trait Implementations
Construct an in-memory database
Provide the current block height in which the transactions should be executed. Read more
Provide the block hash from a given height.
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
Check if a provided contract exists in the chain.
Fetch a previously inserted salt+root tuple from the chain state for a given contract. Read more
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_color_balance(
&self,
id: &ContractId,
color: &Color
) -> Result<Option<u64>, Self::DataError>
fn merkle_contract_color_balance(
&self,
id: &ContractId,
color: &Color
) -> Result<Option<u64>, Self::DataError>
Fetch the balance of a color in a contract storage.
fn merkle_contract_color_balance_insert(
&mut self,
contract: &ContractId,
color: &Color,
value: u64
) -> Result<Option<u64>, Self::DataError>
fn merkle_contract_color_balance_insert(
&mut self,
contract: &ContractId,
color: &Color,
value: u64
) -> Result<Option<u64>, Self::DataError>
Update the balance of a color in a contract storage.
type Error = KvStoreError
type Error = KvStoreError
Error implementation of the storage functions
Append K->V
mapping to the storage. Read more
Remove K->V
mapping from the storage. Read more
Retrieve Cow<V>
such as K->V
.
Return true
if there is a K
mapping to a value in the storage.
type Error = KvStoreError
type Error = KvStoreError
Error implementation of the storage functions
fn 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
Remove K->V
mapping from the storage. Read more
Retrieve Cow<V>
such as K->V
.
Return true
if there is a K
mapping to a value in the storage.
type Error = KvStoreError
type Error = KvStoreError
Error implementation of the storage functions
Append K->V
mapping to the storage. Read more
Remove K->V
mapping from the storage. Read more
Retrieve Cow<V>
such as K->V
.
Return true
if there is a K
mapping to a value in the storage.
type Error = KvStoreError
type Error = KvStoreError
Error implementation of the storage functions
Append K->V
mapping to the storage. Read more
Remove K->V
mapping from the storage. Read more
Retrieve Cow<V>
such as K->V
.
Return true
if there is a K
mapping to a value in the storage.
Auto Trait Implementations
impl !RefUnwindSafe for Database
impl !UnwindSafe for Database
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more