dbbackup

package
v0.1.49 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package dbbackup captures and restores snapshots of a database Egg, for point-in-time recovery. A capture runs pg_dump inside the Egg's own container and streams the dump to a durable file on the host (so the data never leaves the box); a restore pipes a chosen dump back into the container. Both run ASYNCHRONOUSLY (a dump/restore can take minutes and must not block the reconcile tick), reporting incremental progress the agent ships on the status endpoint.

Phase 1 stores snapshots locally on the Egg's host: this survives a logical mistake (a bad migration, a dropped table), not the host disk dying. A later phase relays them to a durable off-host Vault. British English. No em dashes. Nothing secret is logged (the DB password lives only in the container's own environment).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backuper

type Backuper struct {
	// contains filtered or unexported fields
}

Backuper tracks in-flight backup operations, one per (backup id, action). Keying on the action too matters because the SAME backup id flows through several actions on one host (capture then upload on the source; store then fetch on the Vault); a job keyed on the id alone would return a stale "done" for the next action.

func New

func New(relay Relay) *Backuper

New returns a Backuper that relays through the given endpoints.

func (*Backuper) Ensure

func (b *Backuper) Ensure(ctx context.Context, containerID, blobID string, d *contract.BackupDirective) (done bool, report *contract.BackupReport)

Ensure runs the backup for d.BackupID against the given running container the first time it is seen, then returns incremental progress on every call. blobID locates the on-host snapshot directory. Idempotent and cheap once a job exists.

type Relay added in v0.1.20

type Relay struct {
	// Upload PUTs size bytes from body to the staging endpoint for relayID.
	Upload func(ctx context.Context, relayID string, body io.Reader, size int64) error
	// Download GETs the staged bytes for relayID into dst, returning their sha256.
	Download func(ctx context.Context, relayID string, dst io.Writer) (checksum string, err error)
}

Relay moves snapshot bytes to and from the control-plane staging endpoints, so a snapshot can be copied off its host onto a Vault (and fetched back for a restore). The agent supplies these, host-token authorised.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL