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::{
19        compute_history_rank, history_info, needs_prev_shard_check, HistoricalStateProvider,
20        HistoricalStateProviderRef, HistoryInfo, LowestAvailableBlocks,
21    },
22    latest::{LatestStateProvider, LatestStateProviderRef},
23    overlay::{OverlayStateProvider, OverlayStateProviderFactory},
24};
25
26mod consistent_view;
27pub use consistent_view::{ConsistentDbView, ConsistentViewError};
28
29mod blockchain_provider;
30pub use blockchain_provider::BlockchainProvider;
31
32mod consistent;
33pub use consistent::ConsistentProvider;
34
35// RocksDB currently only supported on Unix platforms
36// Windows support is planned for future releases
37#[cfg_attr(all(unix, feature = "rocksdb"), path = "rocksdb/mod.rs")]
38#[cfg_attr(not(all(unix, feature = "rocksdb")), path = "rocksdb_stub.rs")]
39pub(crate) mod rocksdb;
40
41pub use rocksdb::{
42    PruneShardOutcome, PrunedIndices, RocksDBBatch, RocksDBBuilder, RocksDBIter, RocksDBProvider,
43    RocksDBRawIter, RocksDBStats, RocksDBTableStats, RocksTx,
44};
45
46/// Helper trait to bound [`NodeTypes`] so that combined with database they satisfy
47/// [`ProviderNodeTypes`].
48pub trait NodeTypesForProvider
49where
50    Self: NodeTypes<
51        ChainSpec: EthereumHardforks,
52        Storage: ChainStorage<Self::Primitives>,
53        Primitives: NodePrimitives<SignedTx: Value, Receipt: Value, BlockHeader: Value>,
54    >,
55{
56}
57
58impl<T> NodeTypesForProvider for T where
59    T: NodeTypes<
60        ChainSpec: EthereumHardforks,
61        Storage: ChainStorage<T::Primitives>,
62        Primitives: NodePrimitives<SignedTx: Value, Receipt: Value, BlockHeader: Value>,
63    >
64{
65}
66
67/// Helper trait keeping common requirements of providers for [`NodeTypesWithDB`].
68pub trait ProviderNodeTypes
69where
70    Self: NodeTypesForProvider + NodeTypesWithDB,
71{
72}
73impl<T> ProviderNodeTypes for T where T: NodeTypesForProvider + NodeTypesWithDB {}