Documentation
¶
Overview ¶
Package backups owns the v1.12 phase 8 backup/restore workflow.
SQLite: SQL `VACUUM INTO 'path'` writes a consistent snapshot to a fresh file on disk. The file is portable — operators copy it off-host for archival.
Postgres: shell out to `pg_dump` with the daemon's DSN. The binary must be on PATH; the daemon process must have permission to write to the configured backup directory. Restore is a manual `pg_restore` step documented in OPERATIONS.md — too destructive to expose as a one-click UI affordance.
The catalog table (backups) is the index — every Create records one row with the path + size + kind so the operator can pick which one to restore from.
Index ¶
- Constants
- type Backup
- type Manager
- func (m *Manager) ByID(ctx context.Context, id string) (*Backup, error)
- func (m *Manager) Create(ctx context.Context, note, triggeredBy string) (*Backup, error)
- func (m *Manager) Delete(ctx context.Context, id string) error
- func (m *Manager) Dir() string
- func (m *Manager) List(ctx context.Context) ([]*Backup, error)
Constants ¶
const ( KindSQLite = "sqlite" KindPostgres = "postgres" )
Kind names the backup format.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backup ¶
type Backup struct {
ID string
CreatedAt time.Time
Kind string // "sqlite" or "postgres"
Path string
SizeBytes int64
Status string // "ok", "failed", "in_progress"
Note string
TriggeredBy string
}
Backup is the in-memory shape of one catalog row.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager wraps the catalog + the on-disk dump operations.
func New ¶
New returns a Manager bound to st with backups landing under dir. dsn is the Postgres connection string when st is Postgres-backed; ignored for SQLite.
func (*Manager) Create ¶
Create dumps the daemon's database into m.dir. Returns the Backup row recorded in the catalog. note is a free-form operator label (e.g. "pre-v1.12-upgrade"); triggeredBy is the user ID — empty for scheduled / automatic backups.