Skip to main content

Module dump

Module dump 

Source
Expand description

Full-database dump (snapshot) pipeline.

Produces consistent, timestamped copies of the embedded redb and sqlite databases in the configured dump directory, together with SHA-256, SHA-512, and/or SHA3-512 hash sidecar files (extensions .sha-256, .sha-512, .sha3-512 per CLAUDE.md).

The pipeline has two write paths:

  • sqlite: uses the rusqlite::backup::Backup API so the copy is consistent regardless of WAL / SHM state.
  • redb: redb is copy-on-write; holding an active read transaction while copying the file is enough to pin a consistent snapshot because writers allocate new pages instead of mutating existing ones.

Both dumps are verified after write (a fresh open + integrity check) before the function returns Ok.

Hash sidecars are produced via crate::sidecar::write_sidecar_files_for, which preserves the full file extension (csaf.redb.sha-256, not csaf.sha-256).

Structs§

DumpResult
Result of a successful database dump.

Functions§

dump_database
Take a consistent snapshot of the live redb + sqlite databases into dump_dir and emit hash sidecars based on the settings.