db-snapshot: allow to set directory where snapshots are stored

Fix #926
This commit is contained in:
Baptiste Jonglez
2025-01-24 19:21:08 +01:00
parent 0156e40c9d
commit 59c153d280
3 changed files with 33 additions and 2 deletions
+8 -2
View File
@@ -41,8 +41,14 @@ pub fn snapshot_metadata(garage: &Garage) -> Result<(), Error> {
}
};
let mut snapshots_dir = garage.config.metadata_dir.clone();
snapshots_dir.push("snapshots");
let snapshots_dir = match &garage.config.metadata_snapshots_dir {
Some(d) => d.clone(),
None => {
let mut default_snapshots_dir = garage.config.metadata_dir.clone();
default_snapshots_dir.push("snapshots");
default_snapshots_dir
}
};
fs::create_dir_all(&snapshots_dir)?;
let mut new_path = snapshots_dir.clone();
+3
View File
@@ -31,6 +31,9 @@ pub struct Config {
#[serde(default)]
pub use_local_tz: bool,
/// Optional directory where metadata snapshots will be store
pub metadata_snapshots_dir: Option<PathBuf>,
/// Automatic snapshot interval for metadata
#[serde(default)]
pub metadata_auto_snapshot_interval: Option<String>,