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    PruneShardOutcome, PrunedIndices, RocksDBBatch, RocksDBBuilder, RocksDBIter, RocksDBProvider,
32    RocksDBRawIter, RocksDBStats, RocksDBTableStats, RocksReadSnapshot, RocksTx,
33};
34
35/// Helper trait to bound [`NodeTypes`] so that combined with database they satisfy
36/// [`ProviderNodeTypes`].
37pub trait NodeTypesForProvider
38where
39    Self: NodeTypes<
40        ChainSpec: EthereumHardforks,
41        Storage: ChainStorage<Self::Primitives>,
42        Primitives: NodePrimitives<SignedTx: Value, Receipt: Value, BlockHeader: Value>,
43    >,
44{
45}
46
47impl<T> NodeTypesForProvider for T where
48    T: NodeTypes<
49        ChainSpec: EthereumHardforks,
50        Storage: ChainStorage<T::Primitives>,
51        Primitives: NodePrimitives<SignedTx: Value, Receipt: Value, BlockHeader: Value>,
52    >
53{
54}
55
56/// Helper trait keeping common requirements of providers for [`NodeTypesWithDB`].
57pub trait ProviderNodeTypes
58where
59    Self: NodeTypesForProvider + NodeTypesWithDB,
60{
61}
62impl<T> ProviderNodeTypes for T where T: NodeTypesForProvider + NodeTypesWithDB {}