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