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_BACKEND— set by the node from effective module DB policy (seeblvm_node::storage::database::module_subprocess_database_backend_preference)MODULE_DATABASE_BACKENDenv var (same values; manual override)- Auto-select Sled as first choice, then fall back through Sled→TidesDB
create_databaseattempts
If the resolved backend does not support dynamic trees the function warns and falls back
as above. If no dynamic backend is compiled into blvm-node, 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")?;