pub fn write_database_format_version_to_disk(
config: &Config,
db_kind: impl AsRef<str>,
changed_version: &Version,
network: &Network,
) -> Result<(), BoxError>
Expand description
Writes changed_version
to the on-disk database after the format is changed.
(Or a new database is created.)
The database path is based on its kind, changed_version.major
, and network.
§Correctness
This should only be called:
- after each format upgrade is complete,
- when creating a new database, or
- when an older Zebra version opens a newer database.
§Concurrency
This must only be called while RocksDB has an open database for config
.
Otherwise, multiple Zebra processes could write the version at the same time,
corrupting the file.