pub fn open_module_db<P: AsRef<Path>>(data_dir: P) -> Result<Arc<dyn Database>>Expand description
Open the module’s database at {data_dir}/db/.
Module databases need to create named trees on demand (open_tree()). Only Sled and
TidesDB support fully dynamic tree creation. Redb only supports a fixed set of
pre-declared tables; RocksDB requires all column families to be declared at open time.
Backend selection (first match wins):
MODULE_CONFIG_DATABASE_BACKENDenv var (sled,tidesdb,redb,rocksdb,auto)MODULE_DATABASE_BACKENDenv var (same values)- Auto-select best available: Sled → TidesDB → fallback with a warning
If the resolved backend does not support dynamic trees the function warns and falls back to the best available dynamic backend. If no dynamic backend is compiled in, it returns an error.
§Example
ⓘ
let db = open_module_db(module_data_dir)?;
let tree = db.open_tree("my_tree")?;
tree.insert(b"key", b"value")?;