diff options
author | Alex <alex@adnab.me> | 2022-09-13 16:49:05 +0200 |
---|---|---|
committer | Alex <alex@adnab.me> | 2022-09-13 16:49:05 +0200 |
commit | 80fdbfb0aa1b7186db3aeef888c0954748a35c62 (patch) | |
tree | 20c275ab7019b9c1458e4c2daef56a1b93411f8a /src/model/garage.rs | |
parent | 11bdc971e2aaa1ef90358b7d9c1bd6a8e9743bbf (diff) | |
parent | ab722cb40f5aacf661a280b7eb025acd3aefc1bb (diff) | |
download | garage-80fdbfb0aa1b7186db3aeef888c0954748a35c62.tar.gz garage-80fdbfb0aa1b7186db3aeef888c0954748a35c62.zip |
Merge pull request 'various fixes for v0.8.0' (#380) from various-fixes-for-0.8 into mainv0.8.0-beta1
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/380
Diffstat (limited to 'src/model/garage.rs')
-rw-r--r-- | src/model/garage.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/model/garage.rs b/src/model/garage.rs index 66c359e7..75012952 100644 --- a/src/model/garage.rs +++ b/src/model/garage.rs @@ -6,7 +6,7 @@ use garage_db as db; use garage_util::background::*; use garage_util::config::*; -use garage_util::error::Error; +use garage_util::error::*; use garage_rpc::system::System; @@ -76,9 +76,14 @@ pub struct GarageK2V { impl Garage { /// Create and run garage pub fn new(config: Config, background: Arc<BackgroundRunner>) -> Result<Arc<Self>, Error> { + // 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")?; + info!("Opening database..."); let mut db_path = config.metadata_dir.clone(); - std::fs::create_dir_all(&db_path).expect("Unable to create Garage meta data directory"); let db = match config.db_engine.as_str() { // ---- Sled DB ---- #[cfg(feature = "sled")] @@ -164,7 +169,7 @@ impl Garage { background.clone(), replication_mode.replication_factor(), &config, - ); + )?; let data_rep_param = TableShardedReplication { system: system.clone(), |