pub struct DatabaseTransaction { /* private fields */ }

Methods from Deref<Target = Database>§

source

pub fn latest_height(&self) -> StorageResult<BlockHeight>

source

pub fn get_current_block( &self ) -> StorageResult<Option<Cow<'_, CompressedBlock>>>

Get the current block at the head of the chain.

source

pub fn block_time(&self, height: &BlockHeight) -> StorageResult<Tai64>

source

pub fn get_block_id( &self, height: &BlockHeight ) -> StorageResult<Option<BlockId>>

source

pub fn all_block_ids( &self, start: Option<BlockHeight>, direction: IterDirection ) -> impl Iterator<Item = DatabaseResult<(BlockHeight, BlockId)>> + '_

source

pub fn ids_of_genesis_block(&self) -> DatabaseResult<(BlockHeight, BlockId)>

source

pub fn ids_of_latest_block( &self ) -> DatabaseResult<Option<(BlockHeight, BlockId)>>

source

pub fn block_history_proof( &self, message_block_height: &BlockHeight, commit_block_height: &BlockHeight ) -> StorageResult<MerkleProof>

source

pub fn get_contract_config_by_id( &self, contract_id: ContractId ) -> StorageResult<ContractConfig>

source

pub fn contract_balances( &self, contract: ContractId, start_asset: Option<AssetId>, direction: Option<IterDirection> ) -> impl Iterator<Item = DatabaseResult<(AssetId, Word)>> + '_

source

pub fn get_contract_config(&self) -> StorageResult<Option<Vec<ContractConfig>>>

source

pub fn owned_message_ids( &self, owner: &Address, start_message_id: Option<Nonce>, direction: Option<IterDirection> ) -> impl Iterator<Item = DatabaseResult<Nonce>> + '_

source

pub fn all_messages( &self, start: Option<Nonce>, direction: Option<IterDirection> ) -> impl Iterator<Item = DatabaseResult<Message>> + '_

source

pub fn get_message_config(&self) -> StorageResult<Option<Vec<MessageConfig>>>

source

pub fn is_message_spent(&self, id: &Nonce) -> StorageResult<bool>

source

pub fn get_sealed_block_by_id( &self, block_id: &BlockId ) -> StorageResult<Option<SealedBlock>>

source

pub fn get_sealed_block_by_height( &self, height: &BlockHeight ) -> StorageResult<Option<SealedBlock>>

Returns SealedBlock by height. Reusable across different trait implementations

source

pub fn get_genesis(&self) -> StorageResult<Genesis>

source

pub fn get_sealed_block_header_by_height( &self, height: &BlockHeight ) -> StorageResult<Option<SealedBlockHeader>>

source

pub fn get_sealed_block_header( &self, block_id: &BlockId ) -> StorageResult<Option<SealedBlockHeader>>

source

pub fn get_transactions_on_block( &self, block_id: &BlockId ) -> StorageResult<Option<Vec<Transaction>>>

source

pub fn owned_coins_ids( &self, owner: &Address, start_coin: Option<UtxoId>, direction: Option<IterDirection> ) -> impl Iterator<Item = DatabaseResult<UtxoId>> + '_

source

pub fn coin(&self, utxo_id: &UtxoId) -> StorageResult<CompressedCoin>

source

pub fn get_coin_config(&self) -> DatabaseResult<Option<Vec<CoinConfig>>>

source

pub fn init(&self, config: &ChainConfig) -> DatabaseResult<()>

Ensures the database is initialized and that the database version is correct

source

pub fn get_chain_name(&self) -> DatabaseResult<Option<String>>

source

pub fn all_transactions( &self, start: Option<&Bytes32>, direction: Option<IterDirection> ) -> impl Iterator<Item = DatabaseResult<Transaction>> + '_

source

pub fn owned_transactions( &self, owner: Address, start: Option<OwnedTransactionIndexCursor>, direction: Option<IterDirection> ) -> impl Iterator<Item = DatabaseResult<(TxPointer, Bytes32)>> + '_

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.

source

pub fn record_tx_id_owner( &self, owner: &Address, block_height: BlockHeight, tx_idx: TransactionIndex, tx_id: &Bytes32 ) -> DatabaseResult<Option<Bytes32>>

source

pub fn update_tx_status( &self, id: &Bytes32, status: TransactionStatus ) -> DatabaseResult<Option<TransactionStatus>>

source

pub fn get_tx_status( &self, id: &Bytes32 ) -> DatabaseResult<Option<TransactionStatus>>

source

pub fn transaction(&self) -> DatabaseTransaction

Trait Implementations§

source§

impl AsMut<Database> for DatabaseTransaction

source§

fn as_mut(&mut self) -> &mut Database

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsRef<Database> for DatabaseTransaction

source§

fn as_ref(&self) -> &Database

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for DatabaseTransaction

source§

fn clone(&self) -> DatabaseTransaction

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for DatabaseTransaction

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for DatabaseTransaction

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Deref for DatabaseTransaction

§

type Target = Database

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl DerefMut for DatabaseTransaction

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl From<&Database> for DatabaseTransaction

source§

fn from(source: &Database) -> Self

Converts to this type from the input type.
source§

impl Transaction<Database> for DatabaseTransaction

source§

fn commit(&mut self) -> StorageResult<()>

Commits the pending state changes into the storage.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AnyDebug for Twhere T: Any + Debug,

§

fn as_any_ref(&self) -> &(dyn Any + 'static)

Returns a reference to the underlying type as Any.
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
§

impl<T> StorageAsMut for T

§

fn storage<Type>(&mut self) -> StorageMut<'_, Self, Type>where Type: Mappable,

§

fn storage_as_mut<Type>(&mut self) -> StorageMut<'_, Self, Type>where Type: Mappable,

§

impl<T> StorageAsRef for T

§

fn storage<Type>(&self) -> StorageRef<'_, Self, Type>where Type: Mappable,

§

fn storage_as_ref<Type>(&self) -> StorageRef<'_, Self, Type>where Type: Mappable,

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more