aboutsummaryrefslogtreecommitdiff
path: root/src/model/garage.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-09-04 14:49:49 +0200
committerAlex Auvolat <alex@adnab.me>2023-09-06 16:35:28 +0200
commit71c0188055e25aa1c00d0226f0ca99ce323310a6 (patch)
treee02f35033a601a502672e6c0294e5cc06ff3b563 /src/model/garage.rs
parent4b4f2000f45a83b4dad3f2a8fd8392a245a30286 (diff)
downloadgarage-71c0188055e25aa1c00d0226f0ca99ce323310a6.tar.gz
garage-71c0188055e25aa1c00d0226f0ca99ce323310a6.zip
block manager: skeleton for multi-hdd support
Diffstat (limited to 'src/model/garage.rs')
-rw-r--r--src/model/garage.rs18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/model/garage.rs b/src/model/garage.rs
index 981430fb..d6eebfb0 100644
--- a/src/model/garage.rs
+++ b/src/model/garage.rs
@@ -92,8 +92,22 @@ impl Garage {
// Create meta dir and data dir if they don't exist already
std::fs::create_dir_all(&config.metadata_dir)
.ok_or_message("Unable to create Garage metadata directory")?;
- std::fs::create_dir_all(&config.data_dir)
- .ok_or_message("Unable to create Garage data directory")?;
+ match &config.data_dir {
+ DataDirEnum::Single(data_dir) => {
+ std::fs::create_dir_all(data_dir).ok_or_message(format!(
+ "Unable to create Garage data directory: {}",
+ data_dir.to_string_lossy()
+ ))?;
+ }
+ DataDirEnum::Multiple(data_dirs) => {
+ for dir in data_dirs {
+ std::fs::create_dir_all(&dir.path).ok_or_message(format!(
+ "Unable to create Garage data directory: {}",
+ dir.path.to_string_lossy()
+ ))?;
+ }
+ }
+ }
info!("Opening database...");
let mut db_path = config.metadata_dir.clone();