chore: move prune event type (#12732)

This commit is contained in:
Matthias Seitz
2024-11-21 11:41:34 +01:00
committed by GitHub
parent b9169399f3
commit c2e6938606
7 changed files with 27 additions and 17 deletions

2
Cargo.lock generated
View File

@ -8122,7 +8122,7 @@ dependencies = [
"reth-engine-primitives",
"reth-network-api",
"reth-primitives-traits",
"reth-prune",
"reth-prune-types",
"reth-stages",
"reth-static-file-types",
"reth-storage-api",

View File

@ -16,7 +16,7 @@ reth-storage-api.workspace = true
reth-beacon-consensus.workspace = true
reth-network-api.workspace = true
reth-stages.workspace = true
reth-prune.workspace = true
reth-prune-types.workspace = true
reth-static-file-types.workspace = true
reth-primitives-traits.workspace = true
reth-engine-primitives.workspace = true

View File

@ -9,7 +9,7 @@ use reth_beacon_consensus::{BeaconConsensusEngineEvent, ConsensusEngineLiveSyncP
use reth_engine_primitives::ForkchoiceStatus;
use reth_network_api::{NetworkEvent, PeersInfo};
use reth_primitives_traits::{format_gas, format_gas_throughput};
use reth_prune::PrunerEvent;
use reth_prune_types::PrunerEvent;
use reth_stages::{EntitiesCheckpoint, ExecOutput, PipelineEvent, StageCheckpoint, StageId};
use reth_static_file_types::StaticFileProducerEvent;
use std::{

View File

@ -1,12 +0,0 @@
use alloy_primitives::BlockNumber;
use reth_prune_types::PrunedSegmentInfo;
use std::time::Duration;
/// An event emitted by a [Pruner][crate::Pruner].
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum PrunerEvent {
/// Emitted when pruner started running.
Started { tip_block_number: BlockNumber },
/// Emitted when pruner finished running.
Finished { tip_block_number: BlockNumber, elapsed: Duration, stats: Vec<PrunedSegmentInfo> },
}

View File

@ -12,7 +12,6 @@
mod builder;
mod db_ext;
mod error;
mod event;
mod metrics;
mod pruner;
pub mod segments;
@ -20,7 +19,6 @@ pub mod segments;
use crate::metrics::Metrics;
pub use builder::PrunerBuilder;
pub use error::PrunerError;
pub use event::PrunerEvent;
pub use pruner::{Pruner, PrunerResult, PrunerWithFactory, PrunerWithResult};
// Re-export prune types

View File

@ -0,0 +1,22 @@
use crate::PrunedSegmentInfo;
use alloy_primitives::BlockNumber;
use std::time::Duration;
/// An event emitted by a pruner.
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum PrunerEvent {
/// Emitted when pruner started running.
Started {
/// The tip block number before pruning.
tip_block_number: BlockNumber,
},
/// Emitted when pruner finished running.
Finished {
/// The tip block number before pruning.
tip_block_number: BlockNumber,
/// The elapsed time for the pruning process.
elapsed: Duration,
/// Collected pruning stats.
stats: Vec<PrunedSegmentInfo>,
},
}

View File

@ -9,6 +9,7 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
mod checkpoint;
mod event;
mod limiter;
mod mode;
mod pruner;
@ -16,6 +17,7 @@ mod segment;
mod target;
pub use checkpoint::PruneCheckpoint;
pub use event::PrunerEvent;
pub use limiter::PruneLimiter;
pub use mode::PruneMode;
pub use pruner::{