switchyard-fs 1.0.0

Switchyard: safe, atomic, reversible filesystem swaps with policy and audit
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::fs::backup::index::{find_latest_backup_and_sidecar, find_previous_backup_and_sidecar};
use std::path::{Path, PathBuf};

/// Return (`backup_path_if_present`, `sidecar_path`) for the latest timestamped pair.
#[must_use]
pub fn latest(target: &Path, tag: &str) -> Option<(Option<PathBuf>, PathBuf)> {
    find_latest_backup_and_sidecar(target, tag)
}

/// Return (`backup_path_if_present`, `sidecar_path`) for the previous (second newest) pair.
#[must_use]
pub fn previous(target: &Path, tag: &str) -> Option<(Option<PathBuf>, PathBuf)> {
    find_previous_backup_and_sidecar(target, tag)
}