Files
nmon/internal/backup/doc.go

19 lines
1.1 KiB
Go

// Package backup writes and restores nmon's one-file backup.
//
// A backup is a tar archive holding a consistent copy of every piece of state:
//
// inventory.db SQLite VACUUM INTO copy of the inventory (SQLite deployments), or
// inventory.jsonl the engine-neutral JSON-lines export (Postgres/MySQL; format in internal/store)
// hot/..., long/... the metric stores' own snapshots (/snapshot/create), as the store's data layout
// config.yaml, profiles/... settings and operator profiles
// secret.key the encryption key file, only with IncludeKey
// MANIFEST.json always the last entry
//
// The manifest lists every other entry with its size and SHA-256, so a truncated or damaged archive
// cannot restore: it is written last, which makes "manifest present and every entry matches" the proof of
// a complete archive, including after power loss. Backup writes to a temporary file beside the target,
// syncs it and renames it, so a failure never leaves a partial file under the final name.
//
// Copying the data folder while nmon runs is not a backup: the stores and the database are mid-write.
package backup