backup: archives with a checksummed manifest, rotation, safe restore

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
terminarandClaude Opus 5.5 committed 2026-11-05 20:41:16 +01:00
1 parent 71b4dda990
commit 764b6f36ea
4 files changed
+796

No files matched your search

+28
View File
@@ -30,6 +30,7 @@ yetano.dev/yetano/core/configcmd
yetano.dev/yetano/core/configfamily
yetano.dev/yetano/core/version
yetano.dev/yetano/core/secretref
yetano.dev/yetano/core/backup
yetano.dev/yetano/core/cobracmd (separate module)
yetano.dev/yetano/core/gui (own module, tags gui/vX.Y.Z)
@@ -486,6 +487,33 @@ plain values it accepted before checks `IsReference` and treats anything
else as a literal. Used by yavebu,
yacry and yadenes.
## core/backup: "<program> backup"
The archive behind `<program> backup create|list|verify|restore` (see
docs/program-conventions.md in the meta-repository). The program
chooses the content; `core/backup` writes, lists, rotates, verifies and
unpacks:
```go
w, err := backup.Create(dir, "yanks-registry", version.Version)
w.AddFile("registry.db", snapshot) // a consistent copy, not the live file
w.AddDir("state", dataDir, skipBlobs) // regular files below a directory
w.AddFile("config/yanks-registry.yaml", cfgPath)
a, err := w.Close() // atomic: complete or nothing
removed, err := backup.Prune(dir, "yanks-registry", backup.DefaultKeep, nil)
m, err := backup.Verify(path) // every file against MANIFEST.json
m, err := backup.Extract(path, newDir) // verified first; only below newDir
```
`<program>-<UTC time>.tar.gz`, a gzip tar with `MANIFEST.json` last
(schema, program, version, time, each file's name, size, mode and
SHA-256). Archives and their directory are owner-only (0600/0700).
`Extract` never writes over anything and never outside its destination
(`..`, absolute names and links are rejected before a byte is written).
`Prune` keeps `Keep{Last, Daily, Weekly, Monthly}` (default 3/7/4/6); an
empty `Keep` removes nothing.
## core/gui (separate module)
`yetano.dev/yetano/core/gui` is the native WebView host for desktop