Skip to main content

Module backup

Module backup 

Source
Expand description

Database backups to S3-compatible storage, and restores from them.

A destination is a bucket (endpoint, region, bucket, prefix, path-style addressing) whose access key pair is kept as org secrets. A backup is a schedule for one database: cron, destination, how many to keep, compression. Each run:

  1. runs the engine’s native dump inside the database’s own instance (pg_dump, mysqldump, mariadb-dump, mongodump, a Redis RDB),
  2. streams its output through gzip or zstd and up to the bucket (one part buffered at a time, multipart beyond crate::s3::PART_SIZE; nothing touches the host’s disk, and the database’s org needs no network path to the bucket: the daemon carries the bytes),
  3. checks the object with a HEAD, then deletes the oldest beyond keep, and emits backup.succeeded or backup.failed.

Objects: <prefix>/<org>/<backup>/<database>-<YYYYMMDDTHHMMSSZ>.<engine>[.gz|.zst].

A restore streams an object back the other way, into the same database or a new one created for it.

Structs§

Backup
BackupFile
A backup object as listed.
BackupSpec
What a user sets on a backup.
Backups
Every org’s destinations and backups.
Destination
An S3-compatible bucket backups go to.
NewDatabase
RestoreRequest
What a restore takes from.

Enums§

Compression

Traits§

Compressor
A writer that compresses into W, finished explicitly.

Functions§

backup_prefix
The key prefix a backup’s objects live under (ends with /).
compressor
Compress into w.
decompressor
Decompress what r reads.
dump_to
Stream a dump out of instance, compressed, into key. Returns the dump’s size and the object’s.
object_key
An object key for a backup taken at t.
parse_key
A key this module wrote: its time, engine and compression.
restore_from
Feed reader to the engine’s restore command in instance. Returns the bytes fed.
select_prune
Which objects retention deletes: everything this module wrote under prefix beyond the newest keep. Keys it did not write are never touched.