diff options
author | Alex <alex@adnab.me> | 2023-10-10 13:28:28 +0000 |
---|---|---|
committer | Alex <alex@adnab.me> | 2023-10-10 13:28:28 +0000 |
commit | e6df7089a19d06696ac2178a4dae7ac9f27fd55e (patch) | |
tree | e1f7120d582f67fd104dc8e746d883befffb4daa /src/util/config.rs | |
parent | e75fe2157d0973eb4320bbc87be5e54a1cb91a63 (diff) | |
parent | 952c9570c494468643353ee1ae9052b510353665 (diff) | |
download | garage-e6df7089a19d06696ac2178a4dae7ac9f27fd55e.tar.gz garage-e6df7089a19d06696ac2178a4dae7ac9f27fd55e.zip |
Merge pull request 'Garage v0.9' (#473) from next into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/473
Diffstat (limited to 'src/util/config.rs')
-rw-r--r-- | src/util/config.rs | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/src/util/config.rs b/src/util/config.rs index ebcb5fbe..ad5c8e1f 100644 --- a/src/util/config.rs +++ b/src/util/config.rs @@ -15,7 +15,14 @@ pub struct Config { /// Path where to store metadata. Should be fast, but low volume pub metadata_dir: PathBuf, /// Path where to store data. Can be slower, but need higher volume - pub data_dir: PathBuf, + pub data_dir: DataDirEnum, + + /// Whether to fsync after all metadata transactions (disabled by default) + #[serde(default)] + pub metadata_fsync: bool, + /// Whether to fsync after all data block writes (disabled by default) + #[serde(default)] + pub data_fsync: bool, /// Size of data blocks to save to disk #[serde( @@ -99,6 +106,26 @@ pub struct Config { pub admin: AdminConfig, } +/// Value for data_dir: either a single directory or a list of dirs with attributes +#[derive(Deserialize, Debug, Clone)] +#[serde(untagged)] +pub enum DataDirEnum { + Single(PathBuf), + Multiple(Vec<DataDir>), +} + +#[derive(Deserialize, Debug, Clone)] +pub struct DataDir { + /// Path to the data directory + pub path: PathBuf, + /// Capacity of the drive (required if read_only is false) + #[serde(default)] + pub capacity: Option<String>, + /// Whether this is a legacy read-only path (capacity should be None) + #[serde(default)] + pub read_only: bool, +} + /// Configuration for S3 api #[derive(Deserialize, Debug, Clone)] pub struct S3ApiConfig { @@ -195,7 +222,7 @@ pub struct KubernetesDiscoveryConfig { } fn default_db_engine() -> String { - "sled".into() + "lmdb".into() } fn default_sled_cache_capacity() -> usize { |