mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: integrate NodeTypesWithDB (#10698)
Co-authored-by: joshieDo <93316087+joshieDo@users.noreply.github.com>
This commit is contained in:
@ -23,6 +23,7 @@ reth-tokio-util.workspace = true
|
||||
reth-config.workspace = true
|
||||
reth-prune-types.workspace = true
|
||||
reth-static-file-types.workspace = true
|
||||
reth-node-types.workspace = true
|
||||
|
||||
# metrics
|
||||
reth-metrics.workspace = true
|
||||
|
||||
@ -3,6 +3,7 @@ use reth_chainspec::MAINNET;
|
||||
use reth_config::PruneConfig;
|
||||
use reth_db_api::database::Database;
|
||||
use reth_exex_types::FinishedExExHeight;
|
||||
use reth_node_types::NodeTypesWithDB;
|
||||
use reth_provider::{providers::StaticFileProvider, ProviderFactory, StaticFileProviderFactory};
|
||||
use reth_prune_types::PruneModes;
|
||||
use std::time::Duration;
|
||||
@ -71,16 +72,14 @@ impl PrunerBuilder {
|
||||
}
|
||||
|
||||
/// Builds a [Pruner] from the current configuration with the given provider factory.
|
||||
pub fn build_with_provider_factory<DB: Database>(
|
||||
pub fn build_with_provider_factory<N: NodeTypesWithDB>(
|
||||
self,
|
||||
provider_factory: ProviderFactory<DB>,
|
||||
) -> Pruner<DB, ProviderFactory<DB>> {
|
||||
let segments = SegmentSet::<DB>::from_components(
|
||||
provider_factory.static_file_provider(),
|
||||
self.segments,
|
||||
);
|
||||
provider_factory: ProviderFactory<N>,
|
||||
) -> Pruner<N::DB, ProviderFactory<N>> {
|
||||
let segments =
|
||||
SegmentSet::from_components(provider_factory.static_file_provider(), self.segments);
|
||||
|
||||
Pruner::<_, ProviderFactory<DB>>::new(
|
||||
Pruner::<_, ProviderFactory<N>>::new(
|
||||
provider_factory,
|
||||
segments.into_vec(),
|
||||
self.block_interval,
|
||||
|
||||
@ -7,7 +7,10 @@ use crate::{
|
||||
use alloy_primitives::BlockNumber;
|
||||
use reth_db_api::database::Database;
|
||||
use reth_exex_types::FinishedExExHeight;
|
||||
use reth_provider::{DatabaseProviderRW, ProviderFactory, PruneCheckpointReader};
|
||||
use reth_node_types::NodeTypesWithDB;
|
||||
use reth_provider::{
|
||||
providers::ProviderNodeTypes, DatabaseProviderRW, ProviderFactory, PruneCheckpointReader,
|
||||
};
|
||||
use reth_prune_types::{PruneLimiter, PruneProgress, PruneSegment, PrunerOutput};
|
||||
use reth_tokio_util::{EventSender, EventStream};
|
||||
use std::time::{Duration, Instant};
|
||||
@ -69,11 +72,11 @@ impl<DB> Pruner<DB, ()> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<DB: Database> Pruner<DB, ProviderFactory<DB>> {
|
||||
impl<N: NodeTypesWithDB> Pruner<N::DB, ProviderFactory<N>> {
|
||||
/// Crates a new pruner with the given provider factory.
|
||||
pub fn new(
|
||||
provider_factory: ProviderFactory<DB>,
|
||||
segments: Vec<Box<dyn Segment<DB>>>,
|
||||
provider_factory: ProviderFactory<N>,
|
||||
segments: Vec<Box<dyn Segment<N::DB>>>,
|
||||
min_block_interval: usize,
|
||||
delete_limit: usize,
|
||||
timeout: Option<Duration>,
|
||||
@ -312,7 +315,7 @@ impl<DB: Database> Pruner<DB, ()> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<DB: Database> Pruner<DB, ProviderFactory<DB>> {
|
||||
impl<N: ProviderNodeTypes> Pruner<N::DB, ProviderFactory<N>> {
|
||||
/// Run the pruner. This will only prune data up to the highest finished ExEx height, if there
|
||||
/// are no ExExes.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user