mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-11 14:56:53 +00:00
garage_db: refactor open function
This commit is contained in:
+1
-12
@@ -116,18 +116,7 @@ impl Garage {
|
||||
info!("Opening database...");
|
||||
let db_engine = db::Engine::from_str(&config.db_engine)
|
||||
.ok_or_message("Invalid `db_engine` value in configuration file")?;
|
||||
let mut db_path = config.metadata_dir.clone();
|
||||
match db_engine {
|
||||
db::Engine::Sqlite => {
|
||||
db_path.push("db.sqlite");
|
||||
}
|
||||
db::Engine::Lmdb => {
|
||||
db_path.push("db.lmdb");
|
||||
}
|
||||
db::Engine::Fjall => {
|
||||
db_path.push("db.fjall");
|
||||
}
|
||||
}
|
||||
let db_path = db_engine.db_path(&config.metadata_dir);
|
||||
let db_opt = db::OpenOpt {
|
||||
fsync: config.metadata_fsync,
|
||||
lmdb_map_size: match config.lmdb_map_size {
|
||||
|
||||
Reference in New Issue
Block a user