Trait reth_provider::DBProvider

pub trait DBProvider:
    Sized
    + Send
    + Sync
    + 'static {
    type Tx: DbTx;

    // Required methods
    fn tx_ref(&self) -> &Self::Tx;
    fn tx_mut(&mut self) -> &mut Self::Tx;
    fn into_tx(self) -> Self::Tx;
    fn prune_modes_ref(&self) -> &PruneModes;

    // Provided methods
    fn disable_long_read_transaction_safety(self) -> Self { ... }
    fn commit(self) -> Result<bool, ProviderError> { ... }
}
Expand description

Database provider.

Required Associated Types§

type Tx: DbTx

Underlying database transaction held by the provider.

Required Methods§

fn tx_ref(&self) -> &Self::Tx

Returns a reference to the underlying transaction.

fn tx_mut(&mut self) -> &mut Self::Tx

Returns a mutable reference to the underlying transaction.

fn into_tx(self) -> Self::Tx

Consumes the provider and returns the underlying transaction.

fn prune_modes_ref(&self) -> &PruneModes

Returns a reference to prune modes.

Provided Methods§

fn disable_long_read_transaction_safety(self) -> Self

Disables long-lived read transaction safety guarantees for leaks prevention and observability improvements.

CAUTION: In most of the cases, you want the safety guarantees for long read transactions enabled. Use this only if you’re sure that no write transaction is open in parallel, meaning that Reth as a node is offline and not progressing.

fn commit(self) -> Result<bool, ProviderError>

Commit database transaction

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<TX: DbTx + 'static> DBProvider for DatabaseProvider<TX>

source§

type Tx = TX