Skip to main content

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, StaticFileWriteCtx, StaticFileWriter,
14};
15
16mod state;
17pub use state::{
18    historical::{compute_history_rank, history_info, needs_prev_shard_check, HistoryInfo},
19    latest::{LatestStateProvider, LatestStateProviderRef},
20};
21
22mod blockchain_provider;
23pub use blockchain_provider::{BlockchainProvider, SNAPSHOT_STATE_RETENTION};
24
25mod consistent;
26pub use consistent::ConsistentProvider;
27
28pub(crate) mod rocksdb;
29
30pub use rocksdb::{
31    OwnedRocksReadSnapshot, PruneShardOutcome, PrunedIndices, RocksDBBatch, RocksDBBuilder,
32    RocksDBIter, RocksDBProvider, RocksDBRawIter, RocksDBStats, RocksDBTableStats,
33    RocksReadSnapshot, RocksTx,
34};
35
36/// Helper trait to bound [`NodeTypes`] so that combined with database they satisfy
37/// [`ProviderNodeTypes`].
38pub trait NodeTypesForProvider
39where
40    Self: NodeTypes<
41        ChainSpec: EthereumHardforks,
42        Storage: ChainStorage<Self::Primitives>,
43        Primitives: NodePrimitives<SignedTx: Value, Receipt: Value, BlockHeader: Value>,
44    >,
45{
46}
47
48impl<T> NodeTypesForProvider for T where
49    T: NodeTypes<
50        ChainSpec: EthereumHardforks,
51        Storage: ChainStorage<T::Primitives>,
52        Primitives: NodePrimitives<SignedTx: Value, Receipt: Value, BlockHeader: Value>,
53    >
54{
55}
56
57/// Helper trait keeping common requirements of providers for [`NodeTypesWithDB`].
58pub trait ProviderNodeTypes
59where
60    Self: NodeTypesForProvider + NodeTypesWithDB,
61{
62}
63impl<T> ProviderNodeTypes for T where T: NodeTypesForProvider + NodeTypesWithDB {}