reth_provider/test_utils/
noop.rs1use crate::{
4 providers::{RocksDBProvider, StaticFileProvider, StaticFileProviderRWRefMut},
5 RocksDBProviderFactory, StaticFileProviderFactory,
6};
7use reth_errors::{ProviderError, ProviderResult};
8use reth_primitives_traits::NodePrimitives;
9use std::path::PathBuf;
10
11pub use reth_storage_api::noop::NoopProvider;
13
14impl<C: Send + Sync, N: NodePrimitives> StaticFileProviderFactory for NoopProvider<C, N> {
15 fn static_file_provider(&self) -> StaticFileProvider<Self::Primitives> {
16 StaticFileProvider::read_only(PathBuf::default(), false).unwrap()
17 }
18
19 fn get_static_file_writer(
20 &self,
21 _block: alloy_primitives::BlockNumber,
22 _segment: reth_static_file_types::StaticFileSegment,
23 ) -> ProviderResult<StaticFileProviderRWRefMut<'_, Self::Primitives>> {
24 Err(ProviderError::ReadOnlyStaticFileAccess)
25 }
26}
27
28impl<C: Send + Sync, N: NodePrimitives> RocksDBProviderFactory for NoopProvider<C, N> {
29 fn rocksdb_provider(&self) -> RocksDBProvider {
30 RocksDBProvider::builder(PathBuf::default()).build().unwrap()
31 }
32
33 #[cfg(all(unix, feature = "rocksdb"))]
34 fn set_pending_rocksdb_batch(&self, _batch: rocksdb::WriteBatchWithTransaction<true>) {
35 }
37}