solana_runtime/
snapshot_config.rs

1use {
2    crate::snapshot_utils::{self, ArchiveFormat, SnapshotVersion},
3    solana_sdk::clock::Slot,
4    std::path::PathBuf,
5};
6
7/// Snapshot configuration and runtime information
8#[derive(Clone, Debug)]
9pub struct SnapshotConfig {
10    /// Generate a new full snapshot archive every this many slots
11    pub full_snapshot_archive_interval_slots: Slot,
12
13    /// Generate a new incremental snapshot archive every this many slots
14    pub incremental_snapshot_archive_interval_slots: Slot,
15
16    /// Path to the directory where full snapshot archives are stored
17    pub full_snapshot_archives_dir: PathBuf,
18
19    /// Path to the directory where incremental snapshot archives are stored
20    pub incremental_snapshot_archives_dir: PathBuf,
21
22    /// Path to the directory where bank snapshots are stored
23    pub bank_snapshots_dir: PathBuf,
24
25    /// The archive format to use for snapshots
26    pub archive_format: ArchiveFormat,
27
28    /// Snapshot version to generate
29    pub snapshot_version: SnapshotVersion,
30
31    /// Maximum number of full snapshot archives to retain
32    pub maximum_full_snapshot_archives_to_retain: usize,
33
34    /// Maximum number of incremental snapshot archives to retain
35    /// NOTE: Incremental snapshots will only be kept for the latest full snapshot
36    pub maximum_incremental_snapshot_archives_to_retain: usize,
37
38    /// This is the `debug_verify` parameter to use when calling `update_accounts_hash()`
39    pub accounts_hash_debug_verify: bool,
40
41    // Thread niceness adjustment for snapshot packager service
42    pub packager_thread_niceness_adj: i8,
43}
44
45impl Default for SnapshotConfig {
46    fn default() -> Self {
47        Self {
48            full_snapshot_archive_interval_slots:
49                snapshot_utils::DEFAULT_FULL_SNAPSHOT_ARCHIVE_INTERVAL_SLOTS,
50            incremental_snapshot_archive_interval_slots:
51                snapshot_utils::DEFAULT_INCREMENTAL_SNAPSHOT_ARCHIVE_INTERVAL_SLOTS,
52            full_snapshot_archives_dir: PathBuf::default(),
53            incremental_snapshot_archives_dir: PathBuf::default(),
54            bank_snapshots_dir: PathBuf::default(),
55            archive_format: ArchiveFormat::TarBzip2,
56            snapshot_version: SnapshotVersion::default(),
57            maximum_full_snapshot_archives_to_retain:
58                snapshot_utils::DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
59            maximum_incremental_snapshot_archives_to_retain:
60                snapshot_utils::DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN,
61            accounts_hash_debug_verify: false,
62            packager_thread_niceness_adj: 0,
63        }
64    }
65}