Skip to main content

Module backup_bootstrap

Module backup_bootstrap 

Source
Expand description

Env-driven BackupBootstrap (issue #517).

Parses the canonical REDDB_BACKUP_* env contract into a BackupConfig. Pure function — env access is injected as a closure so unit tests need no real process env. The red binary calls from_env at boot; the returned Option<BackupConfig> drives Options::with_remote_backend + with_atomic_remote_backend wiring and the archiver / checkpointer task intervals.

Contract:

  • REDDB_BACKUP_S3_ENDPOINT (required)
  • REDDB_BACKUP_S3_BUCKET (required)
  • REDDB_BACKUP_S3_PREFIX (required)
  • REDDB_BACKUP_S3_ACCESS_KEY_ID (required)
  • REDDB_BACKUP_S3_SECRET_ACCESS_KEY (required)
  • REDDB_BACKUP_S3_REGION (default auto)
  • REDDB_BACKUP_CHECKPOINT_INTERVAL_SECS (default 3600, must be > 0)
  • REDDB_BACKUP_WAL_FLUSH_INTERVAL_SECS (default 30, must be > 0)

Resolution:

  • All required vars absent → Ok(None) (standalone; identical to today’s behaviour).
  • All required vars present → Ok(Some(BackupConfig)).
  • Partial config (at least one required present, at least one missing) → Err naming the missing var.
  • Non-numeric / zero interval → Err.

Structs§

BackupConfig
Parsed configuration produced by from_env. Carries everything the red binary needs to construct an S3Backend and the two background tasks (archiver + checkpointer).

Functions§

from_env
Parse the REDDB_BACKUP_* env contract using the supplied env-var lookup. See module docs for the contract.