Documentation
¶
Overview ¶
Package backup implements online backup and restore for BubbleFish Nexus.
Backup creates a crash-safe snapshot of config files, compiled policies, WAL segments, and optionally the SQLite database. Restore verifies SHA256 checksums from a manifest before writing any files.
Reference: Tech Spec Section 14.5.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
func Create(opts CreateOptions) error
Create performs an online backup of BubbleFish Nexus state.
Order of operations (per Tech Spec Section 14.5):
- Config TOML files (daemon.toml, sources/, destinations/, policies/)
- Compiled JSON files (and .sig sidecars)
- SQLite database (if --include-db, via VACUUM INTO)
- WAL segments (copied LAST for online safety)
- manifest.json with SHA256 checksums
func Restore ¶
func Restore(opts RestoreOptions) error
Restore reads a backup and restores all files to their original locations. SHA256 checksums are verified before any files are written.
Without --force, restore refuses to overwrite existing files.
Reference: Tech Spec Section 14.5.
Types ¶
type CreateOptions ¶
type CreateOptions struct {
Dest string // destination directory for the backup
IncludeDB bool // include SQLite database snapshot
Logger *slog.Logger
}
CreateOptions configures a backup create operation.
type Manifest ¶
type Manifest struct {
Version string `json:"version"`
CreatedAt time.Time `json:"created_at"`
ConfigDir string `json:"config_dir"`
IncludesDB bool `json:"includes_db"`
Files []ManifestFile `json:"files"`
}
Manifest describes a backup's contents. It is written as manifest.json in the backup directory.