mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
feat: Snapshotter triggers segment snapshots (#5287)
Co-authored-by: Alexey Shekhirin <a.shekhirin@gmail.com> Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -7,7 +7,7 @@ mod segment;
|
||||
use alloy_primitives::BlockNumber;
|
||||
pub use compression::Compression;
|
||||
pub use filters::{Filters, InclusionFilter, PerfectHashingFunction};
|
||||
pub use segment::{SegmentHeader, SnapshotSegment};
|
||||
pub use segment::{SegmentConfig, SegmentHeader, SnapshotSegment};
|
||||
|
||||
/// Default snapshot block count.
|
||||
pub const BLOCKS_PER_SNAPSHOT: u64 = 500_000;
|
||||
|
||||
@ -36,11 +36,14 @@ pub enum SnapshotSegment {
|
||||
|
||||
impl SnapshotSegment {
|
||||
/// Returns the default configuration of the segment.
|
||||
pub const fn config(&self) -> (Filters, Compression) {
|
||||
let default_config = (
|
||||
Filters::WithFilters(InclusionFilter::Cuckoo, super::PerfectHashingFunction::Fmph),
|
||||
Compression::Lz4,
|
||||
);
|
||||
pub const fn config(&self) -> SegmentConfig {
|
||||
let default_config = SegmentConfig {
|
||||
filters: Filters::WithFilters(
|
||||
InclusionFilter::Cuckoo,
|
||||
super::PerfectHashingFunction::Fmph,
|
||||
),
|
||||
compression: Compression::Lz4,
|
||||
};
|
||||
|
||||
match self {
|
||||
SnapshotSegment::Headers => default_config,
|
||||
@ -133,3 +136,12 @@ impl SegmentHeader {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Configuration used on the segment.
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct SegmentConfig {
|
||||
/// Inclusion filters used on the segment
|
||||
pub filters: Filters,
|
||||
/// Compression used on the segment
|
||||
pub compression: Compression,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user