2021-09-12 11:44:27 -07:00
|
|
|
use crate::snapshot_utils::{self, ArchiveFormat, SnapshotVersion};
|
2021-07-01 06:55:26 -07:00
|
|
|
use solana_sdk::clock::Slot;
|
2021-08-31 20:03:19 -07:00
|
|
|
use std::path::PathBuf;
|
2021-07-01 06:55:26 -07:00
|
|
|
|
|
|
|
/// Snapshot configuration and runtime information
|
|
|
|
#[derive(Clone, Debug)]
|
|
|
|
pub struct SnapshotConfig {
|
2021-08-04 12:40:20 -07:00
|
|
|
/// Generate a new full snapshot archive every this many slots
|
|
|
|
pub full_snapshot_archive_interval_slots: Slot,
|
2021-07-01 06:55:26 -07:00
|
|
|
|
2021-08-04 12:40:20 -07:00
|
|
|
/// Generate a new incremental snapshot archive every this many slots
|
|
|
|
pub incremental_snapshot_archive_interval_slots: Slot,
|
|
|
|
|
2021-08-21 13:41:03 -07:00
|
|
|
/// Path to the directory where snapshot archives are stored
|
|
|
|
pub snapshot_archives_dir: PathBuf,
|
2021-07-01 06:55:26 -07:00
|
|
|
|
2021-08-21 13:41:03 -07:00
|
|
|
/// Path to the directory where bank snapshots are stored
|
|
|
|
pub bank_snapshots_dir: PathBuf,
|
2021-07-01 06:55:26 -07:00
|
|
|
|
|
|
|
/// The archive format to use for snapshots
|
|
|
|
pub archive_format: ArchiveFormat,
|
|
|
|
|
|
|
|
/// Snapshot version to generate
|
|
|
|
pub snapshot_version: SnapshotVersion,
|
|
|
|
|
2021-08-04 12:40:20 -07:00
|
|
|
/// Maximum number of full snapshot archives to retain
|
2021-09-03 09:28:10 -07:00
|
|
|
pub maximum_full_snapshot_archives_to_retain: usize,
|
2021-09-03 13:21:32 -07:00
|
|
|
|
|
|
|
/// Maximum number of incremental snapshot archives to retain
|
|
|
|
/// NOTE: Incremental snapshots will only be kept for the latest full snapshot
|
|
|
|
pub maximum_incremental_snapshot_archives_to_retain: usize,
|
2021-09-13 06:27:50 -07:00
|
|
|
|
|
|
|
/// This is the `use_index` parameter to use when calling `update_accounts_hash()`
|
|
|
|
pub accounts_hash_use_index: bool,
|
|
|
|
|
|
|
|
/// This is the `debug_verify` parameter to use when calling `update_accounts_hash()`
|
|
|
|
pub accounts_hash_debug_verify: bool,
|
2021-07-01 06:55:26 -07:00
|
|
|
}
|
2021-09-12 11:44:27 -07:00
|
|
|
|
|
|
|
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,
|
2021-09-13 06:27:50 -07:00
|
|
|
accounts_hash_use_index: false,
|
|
|
|
accounts_hash_debug_verify: false,
|
2021-09-12 11:44:27 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|