switchyard/fs/restore/
types.rs

1//! Types for restore subsystem
2
3#[derive(Clone, Copy, Debug, Default)]
4pub struct RestoreStats {
5    pub fsync_ms: u64,
6}
7
8/// Which snapshot pair to select for restore
9#[derive(Clone, Copy, Debug)]
10pub enum SnapshotSel {
11    Latest,
12    Previous,
13}
14
15/// Options for restore behavior
16#[derive(Clone, Debug)]
17pub struct RestoreOptions {
18    pub dry_run: bool,
19    pub force_best_effort: bool,
20    pub backup_tag: String,
21}
22
23/// Prior state kind as encoded in sidecar
24#[derive(Clone, Debug, PartialEq, Eq)]
25pub enum PriorKind {
26    File,
27    Symlink,
28    None,
29    Other(String),
30}
31
32impl PriorKind {
33    #[must_use]
34    pub fn from_string(s: &str) -> Self {
35        match s {
36            "file" => PriorKind::File,
37            "symlink" => PriorKind::Symlink,
38            "none" => PriorKind::None,
39            other => PriorKind::Other(other.to_string()),
40        }
41    }
42}