From 0eef8a69f0006de305281dd374cc63e7a46e4b80 Mon Sep 17 00:00:00 2001 From: Zdenek Crha Date: Mon, 22 Jan 2024 20:38:14 +0100 Subject: make all garage_db::Engine variants un-conditional Having all Engine enum variants conditional causes compilation errors when *none* of the DB engine features is enabled. This is not an issue for full garage build, but affects crates that use garage_db as dependency. Change all variants to be present at all times. It solves compilation errors and also allows us to better differentiate between invalid DB engine name and engine with support not compiled in current binary. --- src/garage/cli/convert_db.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/garage') diff --git a/src/garage/cli/convert_db.rs b/src/garage/cli/convert_db.rs index 7307d1cf..044ccbb9 100644 --- a/src/garage/cli/convert_db.rs +++ b/src/garage/cli/convert_db.rs @@ -91,5 +91,13 @@ fn open_db(path: PathBuf, engine: Engine, open: &OpenDbOpt) -> Result { let db = env_builder.open(&path)?; Ok(lmdb_adapter::LmdbDb::init(db)) } + + // Pattern is unreachable when all supported DB engines are compiled into binary. The allow + // attribute is added so that we won't have to change this match in case stop building + // support for one or more engines by default. + #[allow(unreachable_patterns)] + engine => Err(Error( + format!("Engine support not available in this build: {}", engine).into(), + )), } } -- cgit v1.2.3