reth_provider/providers/
mod.rs

1//! Contains the main provider types and traits for interacting with the blockchain's storage.
2
3use reth_chainspec::EthereumHardforks;
4use reth_db_api::table::Value;
5use reth_node_types::{NodePrimitives, NodeTypes, NodeTypesWithDB};
6
7mod database;
8pub use database::*;
9
10mod static_file;
11pub use static_file::{
12    StaticFileAccess, StaticFileJarProvider, StaticFileProvider, StaticFileProviderBuilder,
13    StaticFileProviderRW, StaticFileProviderRWRefMut, StaticFileWriter,
14};
15
16mod state;
17pub use state::{
18    historical::{HistoricalStateProvider, HistoricalStateProviderRef, LowestAvailableBlocks},
19    latest::{LatestStateProvider, LatestStateProviderRef},
20    overlay::{OverlayStateProvider, OverlayStateProviderFactory},
21};
22
23mod consistent_view;
24pub use consistent_view::{ConsistentDbView, ConsistentViewError};
25
26mod blockchain_provider;
27pub use blockchain_provider::BlockchainProvider;
28
29mod consistent;
30pub use consistent::ConsistentProvider;
31
32// RocksDB currently only supported on Unix platforms
33// Windows support is planned for future releases
34#[cfg(all(unix, feature = "rocksdb"))]
35pub(crate) mod rocksdb;
36#[cfg(all(unix, feature = "rocksdb"))]
37pub use rocksdb::{RocksDBBuilder, RocksDBProvider, RocksTx};
38
39/// Helper trait to bound [`NodeTypes`] so that combined with database they satisfy
40/// [`ProviderNodeTypes`].
41pub trait NodeTypesForProvider
42where
43    Self: NodeTypes<
44        ChainSpec: EthereumHardforks,
45        Storage: ChainStorage<Self::Primitives>,
46        Primitives: NodePrimitives<SignedTx: Value, Receipt: Value, BlockHeader: Value>,
47    >,
48{
49}
50
51impl<T> NodeTypesForProvider for T where
52    T: NodeTypes<
53        ChainSpec: EthereumHardforks,
54        Storage: ChainStorage<T::Primitives>,
55        Primitives: NodePrimitives<SignedTx: Value, Receipt: Value, BlockHeader: Value>,
56    >
57{
58}
59
60/// Helper trait keeping common requirements of providers for [`NodeTypesWithDB`].
61pub trait ProviderNodeTypes
62where
63    Self: NodeTypesForProvider + NodeTypesWithDB,
64{
65}
66impl<T> ProviderNodeTypes for T where T: NodeTypesForProvider + NodeTypesWithDB {}