mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: add pretty printing for pruned segment info (#12710)
This commit is contained in:
@ -307,7 +307,11 @@ impl NodeState {
|
||||
info!(tip_block_number, "Pruner started");
|
||||
}
|
||||
PrunerEvent::Finished { tip_block_number, elapsed, stats } => {
|
||||
info!(tip_block_number, ?elapsed, ?stats, "Pruner finished");
|
||||
let stats = format!(
|
||||
"[{}]",
|
||||
stats.iter().map(|item| item.to_string()).collect::<Vec<_>>().join(", ")
|
||||
);
|
||||
info!(tip_block_number, ?elapsed, %stats, "Pruner finished");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
use crate::{PruneCheckpoint, PruneLimiter, PruneMode, PruneSegment};
|
||||
use alloy_primitives::{BlockNumber, TxNumber};
|
||||
use derive_more::Display;
|
||||
|
||||
/// Pruner run output.
|
||||
#[derive(Debug)]
|
||||
@ -17,7 +18,8 @@ impl From<PruneProgress> for PrunerOutput {
|
||||
}
|
||||
|
||||
/// Represents information of a pruner run for a segment.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Display)]
|
||||
#[display("(table={segment}, pruned={pruned}, status={progress})")]
|
||||
pub struct PrunedSegmentInfo {
|
||||
/// The pruned segment
|
||||
pub segment: PruneSegment,
|
||||
@ -77,16 +79,18 @@ impl SegmentOutputCheckpoint {
|
||||
}
|
||||
|
||||
/// Progress of pruning.
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy, Display)]
|
||||
pub enum PruneProgress {
|
||||
/// There is more data to prune.
|
||||
#[display("HasMoreData({_0})")]
|
||||
HasMoreData(PruneInterruptReason),
|
||||
/// Pruning has been finished.
|
||||
#[display("Finished")]
|
||||
Finished,
|
||||
}
|
||||
|
||||
/// Reason for interrupting a prune run.
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy, Display)]
|
||||
pub enum PruneInterruptReason {
|
||||
/// Prune run timed out.
|
||||
Timeout,
|
||||
|
||||
Reference in New Issue
Block a user