use strum::{Display, EnumString, EnumVariantNames, IntoStaticStr, VariantNames};
#[derive(
Debug, Default, Clone, Copy, PartialEq, Eq, Display, EnumString, EnumVariantNames, IntoStaticStr,
)]
#[strum(serialize_all = "kebab-case")]
pub enum UseSnapshotArchivesAtStartup {
Always,
Never,
#[default]
WhenNewest,
}
pub mod cli {
use super::*;
pub const NAME: &str = "use_snapshot_archives_at_startup";
pub const LONG_ARG: &str = "use-snapshot-archives-at-startup";
pub const HELP: &str = "When should snapshot archives be used at startup?";
pub const LONG_HELP: &str = "At startup, when should snapshot archives be extracted \
versus using what is already on disk? \
\nSpecifying \"always\" will always startup by extracting snapshot archives \
and disregard any snapshot-related state already on disk. \
Note that starting up from snapshot archives will incur the runtime costs \
associated with extracting the archives and rebuilding the local state. \
\nSpecifying \"never\" will never startup from snapshot archives \
and will only use snapshot-related state already on disk. \
If there is no state already on disk, startup will fail. \
Note, this will use the latest state available, \
which may be newer than the latest snapshot archive. \
\nSpecifying \"when-newest\" will use snapshot-related state \
already on disk unless there are snapshot archives newer than it. \
This can happen if a new snapshot archive is downloaded \
while the node is stopped.";
pub const POSSIBLE_VALUES: &[&str] = UseSnapshotArchivesAtStartup::VARIANTS;
pub fn default_value() -> &'static str {
UseSnapshotArchivesAtStartup::default().into()
}
pub fn default_value_for_ledger_tool() -> &'static str {
UseSnapshotArchivesAtStartup::Always.into()
}
}