reth_provider/providers/database/
chain.rsuse crate::{providers::NodeTypesForProvider, DatabaseProvider};
use reth_db::transaction::{DbTx, DbTxMut};
use reth_node_types::{FullNodePrimitives, FullSignedTx};
use reth_storage_api::{ChainStorageReader, ChainStorageWriter, EthStorage};
pub trait ChainStorage<Primitives: FullNodePrimitives>: Send + Sync {
fn reader<TX, Types>(&self) -> impl ChainStorageReader<DatabaseProvider<TX, Types>, Primitives>
where
TX: DbTx + 'static,
Types: NodeTypesForProvider<Primitives = Primitives>;
fn writer<TX, Types>(&self) -> impl ChainStorageWriter<DatabaseProvider<TX, Types>, Primitives>
where
TX: DbTxMut + DbTx + 'static,
Types: NodeTypesForProvider<Primitives = Primitives>;
}
impl<N, T> ChainStorage<N> for EthStorage<T>
where
T: FullSignedTx,
N: FullNodePrimitives<
Block = reth_primitives::Block<T>,
BlockBody = reth_primitives::BlockBody<T>,
SignedTx = T,
>,
{
fn reader<TX, Types>(&self) -> impl ChainStorageReader<DatabaseProvider<TX, Types>, N>
where
TX: DbTx + 'static,
Types: NodeTypesForProvider<Primitives = N>,
{
self
}
fn writer<TX, Types>(&self) -> impl ChainStorageWriter<DatabaseProvider<TX, Types>, N>
where
TX: DbTxMut + DbTx + 'static,
Types: NodeTypesForProvider<Primitives = N>,
{
self
}
}