mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-27 15:37:03 +00:00
style: improve lisibility of db_path code
split suffix get from match self and path construction
This commit is contained in:
+6
-13
@@ -26,19 +26,12 @@ impl Engine {
|
|||||||
|
|
||||||
/// Return engine-specific DB path from base path
|
/// Return engine-specific DB path from base path
|
||||||
pub fn db_path(&self, base_path: &Path) -> PathBuf {
|
pub fn db_path(&self, base_path: &Path) -> PathBuf {
|
||||||
let mut ret = base_path.to_path_buf();
|
let suffix = match self {
|
||||||
match self {
|
Self::Lmdb => "db.lmdb",
|
||||||
Self::Lmdb => {
|
Self::Sqlite => "db.sqlite",
|
||||||
ret.push("db.lmdb");
|
Self::Fjall => "db.fjall",
|
||||||
}
|
};
|
||||||
Self::Sqlite => {
|
base_path.join(suffix)
|
||||||
ret.push("db.sqlite");
|
|
||||||
}
|
|
||||||
Self::Fjall => {
|
|
||||||
ret.push("db.fjall");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ret
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user