Move SnapshotConfig into its own module (#18331)
Also move ArchiveFormat to snapshot_utils, and do not reexport SnapshotVersion.
This commit is contained in:
@ -4,7 +4,8 @@
|
||||
|
||||
use crate::{
|
||||
bank::{Bank, BankSlotDelta, DropCallback},
|
||||
bank_forks::{BankForks, SnapshotConfig},
|
||||
bank_forks::BankForks,
|
||||
snapshot_config::SnapshotConfig,
|
||||
snapshot_package::AccountsPackageSender,
|
||||
snapshot_utils,
|
||||
};
|
||||
|
@ -3,6 +3,7 @@
|
||||
use crate::{
|
||||
accounts_background_service::{AbsRequestSender, SnapshotRequest},
|
||||
bank::Bank,
|
||||
snapshot_config::SnapshotConfig,
|
||||
};
|
||||
use log::*;
|
||||
use solana_metrics::inc_new_counter_info;
|
||||
@ -10,41 +11,10 @@ use solana_sdk::{clock::Slot, hash::Hash, timing};
|
||||
use std::{
|
||||
collections::{hash_map::Entry, HashMap, HashSet},
|
||||
ops::Index,
|
||||
path::PathBuf,
|
||||
sync::Arc,
|
||||
time::Instant,
|
||||
};
|
||||
|
||||
pub use crate::snapshot_utils::SnapshotVersion;
|
||||
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||
pub enum ArchiveFormat {
|
||||
TarBzip2,
|
||||
TarGzip,
|
||||
TarZstd,
|
||||
Tar,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct SnapshotConfig {
|
||||
// Generate a new snapshot every this many slots
|
||||
pub snapshot_interval_slots: u64,
|
||||
|
||||
// Where to store the latest packaged snapshot
|
||||
pub snapshot_package_output_path: PathBuf,
|
||||
|
||||
// Where to place the snapshots for recent slots
|
||||
pub snapshot_path: PathBuf,
|
||||
|
||||
pub archive_format: ArchiveFormat,
|
||||
|
||||
// Snapshot version to generate
|
||||
pub snapshot_version: SnapshotVersion,
|
||||
|
||||
// Maximum number of snapshots to retain
|
||||
pub maximum_snapshots_to_retain: usize,
|
||||
}
|
||||
|
||||
pub struct BankForks {
|
||||
banks: HashMap<Slot, Arc<Bank>>,
|
||||
descendants: HashMap<Slot, HashSet<Slot>>,
|
||||
|
@ -33,6 +33,7 @@ mod read_only_accounts_cache;
|
||||
pub mod rent_collector;
|
||||
pub mod secondary_index;
|
||||
pub mod serde_snapshot;
|
||||
pub mod snapshot_config;
|
||||
pub mod snapshot_package;
|
||||
pub mod snapshot_runtime_info;
|
||||
pub mod snapshot_utils;
|
||||
|
26
runtime/src/snapshot_config.rs
Normal file
26
runtime/src/snapshot_config.rs
Normal file
@ -0,0 +1,26 @@
|
||||
use crate::snapshot_utils::ArchiveFormat;
|
||||
use crate::snapshot_utils::SnapshotVersion;
|
||||
use solana_sdk::clock::Slot;
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// Snapshot configuration and runtime information
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct SnapshotConfig {
|
||||
/// Generate a new snapshot every this many slots
|
||||
pub snapshot_interval_slots: Slot,
|
||||
|
||||
/// Where to store the latest packaged snapshot
|
||||
pub snapshot_package_output_path: PathBuf,
|
||||
|
||||
/// Where to place the snapshots for recent slots
|
||||
pub snapshot_path: PathBuf,
|
||||
|
||||
/// The archive format to use for snapshots
|
||||
pub archive_format: ArchiveFormat,
|
||||
|
||||
/// Snapshot version to generate
|
||||
pub snapshot_version: SnapshotVersion,
|
||||
|
||||
/// Maximum number of snapshots to retain
|
||||
pub maximum_snapshots_to_retain: usize,
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
use crate::bank_forks::ArchiveFormat;
|
||||
use crate::snapshot_utils::SnapshotVersion;
|
||||
use crate::snapshot_utils::{ArchiveFormat, SnapshotVersion};
|
||||
use crate::{accounts_db::SnapshotStorages, bank::BankSlotDelta};
|
||||
use solana_sdk::clock::Slot;
|
||||
use solana_sdk::genesis_config::ClusterType;
|
||||
|
@ -3,7 +3,6 @@ use {
|
||||
accounts_db::{AccountShrinkThreshold, AccountsDb},
|
||||
accounts_index::AccountSecondaryIndexes,
|
||||
bank::{Bank, BankSlotDelta, Builtins},
|
||||
bank_forks::ArchiveFormat,
|
||||
hardened_unpack::{unpack_snapshot, ParallelSelector, UnpackError, UnpackedAppendVecMap},
|
||||
serde_snapshot::{
|
||||
bank_from_stream, bank_to_stream, SerdeStyle, SnapshotStorage, SnapshotStorages,
|
||||
@ -103,6 +102,15 @@ impl SnapshotVersion {
|
||||
}
|
||||
}
|
||||
|
||||
/// The different archive formats used for snapshots
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||
pub enum ArchiveFormat {
|
||||
TarBzip2,
|
||||
TarGzip,
|
||||
TarZstd,
|
||||
Tar,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, Debug)]
|
||||
pub struct SlotSnapshotPaths {
|
||||
pub slot: Slot,
|
||||
|
Reference in New Issue
Block a user