Add default() to SnapshotConfig (#19776)

This commit is contained in:
Brooks Prumo
2021-09-12 13:44:27 -05:00
committed by GitHub
parent c9a3b8941f
commit 62c8bcf565
10 changed files with 41 additions and 94 deletions

View File

@ -1,5 +1,4 @@
use crate::snapshot_utils::ArchiveFormat;
use crate::snapshot_utils::SnapshotVersion;
use crate::snapshot_utils::{self, ArchiveFormat, SnapshotVersion};
use solana_sdk::clock::Slot;
use std::path::PathBuf;
@ -31,3 +30,22 @@ pub struct SnapshotConfig {
/// NOTE: Incremental snapshots will only be kept for the latest full snapshot
pub maximum_incremental_snapshot_archives_to_retain: usize,
}
impl Default for SnapshotConfig {
fn default() -> Self {
Self {
full_snapshot_archive_interval_slots:
snapshot_utils::DEFAULT_FULL_SNAPSHOT_ARCHIVE_INTERVAL_SLOTS,
incremental_snapshot_archive_interval_slots:
snapshot_utils::DEFAULT_INCREMENTAL_SNAPSHOT_ARCHIVE_INTERVAL_SLOTS,
snapshot_archives_dir: PathBuf::default(),
bank_snapshots_dir: PathBuf::default(),
archive_format: ArchiveFormat::TarBzip2,
snapshot_version: SnapshotVersion::default(),
maximum_full_snapshot_archives_to_retain:
snapshot_utils::DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
maximum_incremental_snapshot_archives_to_retain:
snapshot_utils::DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN,
}
}
}