Expand description
Module database utilities
Each module has its own database at {data_dir}/db/. Use this helper to open it.
MODULE_CONFIG_DATABASE_BACKEND is normally set by the node when spawning a module, from
[storage] database_backend and optional [modules] module_database_backend (see
blvm_node::storage::database::module_subprocess_database_backend_preference). That value
matches the chain store name; if it is not suitable for dynamic module trees (RocksDB / Redb),
this crate falls back by trying Sled then TidesDB via
create_database (same order as
try_create_module_kv_database in newer blvm-node).
Structs§
- Migration
Context - Context passed to migration functions. Provides put/get/delete against the module’s schema tree and access to the database for opening other trees.
Functions§
- open_
module_ db - Open the module’s database at
{data_dir}/db/. - run_
migrations - Run pending up migrations. Opens the “schema” tree, reads current version, runs each migration with version > current in order, then updates schema_version.
- run_
migrations_ down - Rollback migrations down to
target_version(exclusive). Runs down migrations in reverse order for each applied version > target_version. Requires down functions to be provided. - run_
migrations_ with_ down - Run pending up migrations. Supports optional down migrations for rollback.
Type Aliases§
- Migration
- Migration pair: (version, up, optional down for rollback).
- Migration
Down - A single down migration step (for rollback).
- Migration
Up - A single up migration step.