Trait cuprate_txpool::tables::Tables

source ·
pub trait Tables {
    // Required methods
    fn transaction_blobs(&self) -> &impl DatabaseRo<TransactionBlobs>;
    fn transaction_infos(&self) -> &impl DatabaseRo<TransactionInfos>;
    fn cached_verification_state(
        &self,
    ) -> &impl DatabaseRo<CachedVerificationState>;
    fn spent_key_images(&self) -> &impl DatabaseRo<SpentKeyImages>;
    fn all_tables_empty(&self) -> Result<bool, RuntimeError>;
}
Expand description

Object containing all opened Tables in read-only mode.

This is an encapsulated object that contains all available Table’s in read-only mode.

It is a Sealed trait and is only implemented on a (tuple, containing, all, table, types, ...).

This is used to return a single object from functions like OpenTables::open_tables rather than the tuple containing the tables itself.

To replace tuple.0 style indexing, field_accessor_functions() are provided on this trait, which essentially map the object to fields containing the particular database table, for example:

let tables = open_tables();

// The accessor function `block_infos()` returns the field
// containing an open database table for `BlockInfos`.
let _ = tables.block_infos();

See also:

Required Methods§

source

fn transaction_blobs(&self) -> &impl DatabaseRo<TransactionBlobs>

Access an opened TransactionBlobs database.

source

fn transaction_infos(&self) -> &impl DatabaseRo<TransactionInfos>

Access an opened TransactionInfos database.

source

fn cached_verification_state(&self) -> &impl DatabaseRo<CachedVerificationState>

Access an opened CachedVerificationState database.

source

fn spent_key_images(&self) -> &impl DatabaseRo<SpentKeyImages>

Access an opened SpentKeyImages database.

source

fn all_tables_empty(&self) -> Result<bool, RuntimeError>

This returns true if all tables are empty.

§Errors

This returns errors on regular database errors.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<TRANSACTIONBLOBS, TRANSACTIONINFOS, CACHEDVERIFICATIONSTATE, SPENTKEYIMAGES> Tables for (TRANSACTIONBLOBS, TRANSACTIONINFOS, CACHEDVERIFICATIONSTATE, SPENTKEYIMAGES)
where TRANSACTIONBLOBS: DatabaseRo<TransactionBlobs>, TRANSACTIONINFOS: DatabaseRo<TransactionInfos>, CACHEDVERIFICATIONSTATE: DatabaseRo<CachedVerificationState>, SPENTKEYIMAGES: DatabaseRo<SpentKeyImages>,

Implementors§