Skip to main content

dump_database

Function dump_database 

Source
pub fn dump_database(
    data_dir: &Path,
    dump_dir: &Path,
    storage: &CsafStorage,
    pool: &DbPool,
    settings: &Settings,
) -> Result<DumpResult>
Expand description

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

§Arguments

  • data_dir — where the live csaf.redb / csaf.sqlite files live (the same data_dir configured in [csaf-core::config::AppConfig]).
  • dump_dir — target directory. Created if missing.
  • pool — live sqlite pool (used for the backup-API snapshot).
  • settings — read for the sidecar_sha256 / sidecar_sha512 / sidecar_sha3_512 toggles. No other fields are consulted.

§Errors

  • CsafError::Io if the target directory can’t be created, or the on-disk redb file can’t be copied.
  • CsafError::Storage if redb refuses to open the source or the freshly-written copy.
  • CsafError::Database on any sqlite backup error.