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_attr(all(unix, feature = "rocksdb"), path = "rocksdb/mod.rs")]
35#[cfg_attr(not(all(unix, feature = "rocksdb")), path = "rocksdb_stub.rs")]
36pub(crate) mod rocksdb;
37
38pub use rocksdb::{RocksDBBatch, RocksDBBuilder, RocksDBProvider, RocksTx};
39
40/// Helper trait to bound [`NodeTypes`] so that combined with database they satisfy
41/// [`ProviderNodeTypes`].
42pub trait NodeTypesForProvider
43where
44    Self: NodeTypes<
45        ChainSpec: EthereumHardforks,
46        Storage: ChainStorage<Self::Primitives>,
47        Primitives: NodePrimitives<SignedTx: Value, Receipt: Value, BlockHeader: Value>,
48    >,
49{
50}
51
52impl<T> NodeTypesForProvider for T where
53    T: NodeTypes<
54        ChainSpec: EthereumHardforks,
55        Storage: ChainStorage<T::Primitives>,
56        Primitives: NodePrimitives<SignedTx: Value, Receipt: Value, BlockHeader: Value>,
57    >
58{
59}
60
61/// Helper trait keeping common requirements of providers for [`NodeTypesWithDB`].
62pub trait ProviderNodeTypes
63where
64    Self: NodeTypesForProvider + NodeTypesWithDB,
65{
66}
67impl<T> ProviderNodeTypes for T where T: NodeTypesForProvider + NodeTypesWithDB {}