Skip to main content

Module backup

Module backup 

Source
Expand description

Backup and restore of the database and the file vault.

A backup directory written by backup contains:

db.dump                    pg_dump --format=custom
vault/objects/ab/cd/<sha>  content-addressed blobs (without the preview cache)
manifest.json              timestamp, version, object count and SHA-256 of db.dump

pg_dump and pg_restore are spawned with an argument array, never through a shell. The database password is passed in the child’s PGPASSWORD environment only; it never appears in an argument or a log message.

Structs§

BackupSummary
Result of a successful backup.
RestoreSummary
Result of a successful restore.

Functions§

backup
Writes a backup of the configured database and vault into dir.
backup_encrypted
Like backup, with every file encrypted with a key derived from passphrase (see crate::backupcrypt). The plain dump exists only for the moment between pg_dump and its encryption, inside dir.
is_encrypted
Whether the backup in dir is encrypted (from its manifest).
restore
Verifies a backup directory and restores it into the configured database and vault. A database that already contains tables requires force.
restore_with
Like restore; an encrypted backup needs its passphrase. The dump is decrypted to a temporary file in the vault’s tmp/ for pg_restore and removed afterwards; objects are decrypted straight into the vault.