aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2023-09-11 10:52:01 +0000
committerAlex <alex@adnab.me>2023-09-11 10:52:01 +0000
commit7228fbfd4f62942cf0212d838446ece5ee7f8ef2 (patch)
treeef742d50efb5c3d66145f8a5583e4728c483cb9f /src/util
parent4b4f2000f45a83b4dad3f2a8fd8392a245a30286 (diff)
parentba7ac52c196c452e0b09fef63862264e0c4582bb (diff)
downloadgarage-7228fbfd4f62942cf0212d838446ece5ee7f8ef2.tar.gz
garage-7228fbfd4f62942cf0212d838446ece5ee7f8ef2.zip
Merge pull request 'multi-hdd support (fix #218)' (#625) from multihdd into next
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/625
Diffstat (limited to 'src/util')
-rw-r--r--src/util/config.rs22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/util/config.rs b/src/util/config.rs
index eeb17e0e..9d00fe82 100644
--- a/src/util/config.rs
+++ b/src/util/config.rs
@@ -13,7 +13,7 @@ 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)]
@@ -94,6 +94,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 {