Skip to main content

write_backup

Function write_backup 

Source
pub fn write_backup<W: Write>(
    db: &Database,
    w: &mut W,
    schema_hash: Option<[u8; 32]>,
) -> Result<BackupStats, NookError>
Expand description

Streams every (composite_key, value) entry in db to w in the .nbkp v1 format.

The DB is read under a single redb read transaction (consistent MVCC snapshot โ€” concurrent writers are not blocked). schema_hash is recorded in the header when Some; pass None if no schema is registered with this Database.

ยงErrors

Returns NookError::Storage on I/O failures and NookError::Corruption on internal invariants violated (e.g. composite key with empty prefix โ€” not expected on a well-formed redb).