chore: rename static_files_v2_enabled to new_static_files_enabled

This commit is contained in:
Alexey Shekhirin
2025-11-05 12:33:06 +00:00
parent f950aab039
commit bf4f6ee62d
5 changed files with 41 additions and 30 deletions

View File

@@ -43,10 +43,6 @@ pub use revm_database::states::OriginalValuesKnown;
/// Writer standalone type.
pub mod writer;
/// Write destination type.
pub mod write_destination;
pub use write_destination::StaticFilesConfigurationProvider;
pub use reth_chain_state::{
CanonStateNotification, CanonStateNotificationSender, CanonStateNotificationStream,
CanonStateNotifications, CanonStateSubscriptions,

View File

@@ -64,8 +64,8 @@ pub struct ProviderFactory<N: NodeTypesWithDB> {
prune_modes: PruneModes,
/// The node storage handler.
storage: Arc<N::Storage>,
/// Whether to use static files v2
static_files_v2_enabled: bool,
/// Whether to use new static file segments.
new_static_files_enabled: bool,
}
impl<N: NodeTypes> ProviderFactory<NodeTypesWithDBAdapter<N, Arc<DatabaseEnv>>> {
@@ -88,7 +88,7 @@ impl<N: NodeTypesWithDB> ProviderFactory<N> {
static_file_provider,
prune_modes: PruneModes::default(),
storage: Default::default(),
static_files_v2_enabled: false,
new_static_files_enabled: false,
}
}
@@ -104,9 +104,9 @@ impl<N: NodeTypesWithDB> ProviderFactory<N> {
self
}
/// Enables using static files v2.
pub const fn with_static_files_v2(mut self, enabled: bool) -> Self {
self.static_files_v2_enabled = enabled;
/// Enables using new static file segments.
pub const fn with_new_static_files_enabled(mut self, enabled: bool) -> Self {
self.new_static_files_enabled = enabled;
self
}
@@ -137,7 +137,7 @@ impl<N: NodeTypesWithDB<DB = Arc<DatabaseEnv>>> ProviderFactory<N> {
static_file_provider,
prune_modes: PruneModes::default(),
storage: Default::default(),
static_files_v2_enabled: false,
new_static_files_enabled: false,
})
}
}
@@ -157,7 +157,7 @@ impl<N: ProviderNodeTypes> ProviderFactory<N> {
self.static_file_provider.clone(),
self.prune_modes.clone(),
self.storage.clone(),
self.static_files_v2_enabled,
self.new_static_files_enabled,
))
}
@@ -173,7 +173,7 @@ impl<N: ProviderNodeTypes> ProviderFactory<N> {
self.static_file_provider.clone(),
self.prune_modes.clone(),
self.storage.clone(),
self.static_files_v2_enabled,
self.new_static_files_enabled,
)))
}
@@ -563,7 +563,7 @@ where
static_file_provider,
prune_modes,
storage,
static_files_v2_enabled,
new_static_files_enabled,
} = self;
f.debug_struct("ProviderFactory")
.field("db", &db)
@@ -571,7 +571,7 @@ where
.field("static_file_provider", &static_file_provider)
.field("prune_modes", &prune_modes)
.field("storage", &storage)
.field("static_files_v2_enabled", &static_files_v2_enabled)
.field("new_static_files_enabled", &new_static_files_enabled)
.finish()
}
}
@@ -584,7 +584,7 @@ impl<N: NodeTypesWithDB> Clone for ProviderFactory<N> {
static_file_provider: self.static_file_provider.clone(),
prune_modes: self.prune_modes.clone(),
storage: self.storage.clone(),
static_files_v2_enabled: self.static_files_v2_enabled,
new_static_files_enabled: self.new_static_files_enabled,
}
}
}

View File

@@ -153,8 +153,8 @@ pub struct DatabaseProvider<TX, N: NodeTypes> {
prune_modes: PruneModes,
/// Node storage handler.
storage: Arc<N::Storage>,
/// Whether to use static files v2
static_files_v2_enabled: bool,
/// Whether to use new static file segments.
new_static_files_enabled: bool,
}
impl<TX, N: NodeTypes> DatabaseProvider<TX, N> {
@@ -250,9 +250,16 @@ impl<TX: DbTxMut, N: NodeTypes> DatabaseProvider<TX, N> {
static_file_provider: StaticFileProvider<N::Primitives>,
prune_modes: PruneModes,
storage: Arc<N::Storage>,
static_files_v2_enabled: bool,
new_static_files_enabled: bool,
) -> Self {
Self { tx, chain_spec, static_file_provider, prune_modes, storage, static_files_v2_enabled }
Self {
tx,
chain_spec,
static_file_provider,
prune_modes,
storage,
new_static_files_enabled,
}
}
}
@@ -497,9 +504,16 @@ impl<TX: DbTx + 'static, N: NodeTypesForProvider> DatabaseProvider<TX, N> {
static_file_provider: StaticFileProvider<N::Primitives>,
prune_modes: PruneModes,
storage: Arc<N::Storage>,
static_files_v2_enabled: bool,
new_static_files_enabled: bool,
) -> Self {
Self { tx, chain_spec, static_file_provider, prune_modes, storage, static_files_v2_enabled }
Self {
tx,
chain_spec,
static_file_provider,
prune_modes,
storage,
new_static_files_enabled,
}
}
/// Consume `DbTx` or `DbTxMut`.
@@ -3138,9 +3152,9 @@ impl<TX: DbTx + 'static, N: NodeTypes + 'static> DBProvider for DatabaseProvider
}
}
impl<TX, N: NodeTypes> crate::StaticFilesConfigurationProvider for DatabaseProvider<TX, N> {
fn static_files_v2_enabled(&self) -> bool {
self.static_files_v2_enabled
impl<TX, N: NodeTypes> crate::ProviderConfiguration for DatabaseProvider<TX, N> {
fn new_static_files_enabled(&self) -> bool {
self.new_static_files_enabled
}
}

View File

@@ -10,3 +10,9 @@ pub use static_file_provider::StaticFileProviderFactory;
mod full;
pub use full::FullProvider;
/// Trait for accessing provider configuration.
pub trait ProviderConfiguration {
/// Returns whether new static file segments are enabled.
fn new_static_files_enabled(&self) -> bool;
}

View File

@@ -1,5 +0,0 @@
/// Trait for providers that support configurable static files v2
pub trait StaticFilesConfigurationProvider {
/// Returns whether static files v2 is enabled
fn static_files_v2_enabled(&self) -> bool;
}