Skip to main content

Module database

Module database 

Source
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§

MigrationContext
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).
MigrationDown
A single down migration step (for rollback).
MigrationUp
A single up migration step.