Documentation
¶
Overview ¶
Package volumes owns the daemon-side volume operations: list, backup, restore, clear — all service-scoped.
Backup format: `podman volume export` produces a tar stream; we pipe it through zstd into $XDG_DATA_HOME/a-novel/backups/<stack>/<service>/<volume>/<ts>.tar.zst. Restore reverses: zstd-decompress + `podman volume import`. Clear is auto-backup (unless --no-backup) + `podman volume rm -f`.
Every destructive op (backup, restore, clear) pre-checks that the service's infra + targets are all down — running ops on a live volume produces inconsistent state. --force overrides after cascade-killing the service first.
Index ¶
- func Backup(svc *discovery.Service, tag string) ([]string, error)
- func BackupDir(stack, service, volume string) string
- func Clear(svc *discovery.Service, noBackup bool) ([]string, error)
- func PodmanVolumeName(stack, service, bareVolume string) string
- func Restore(svc *discovery.Service, from string) ([]string, error)
- type Volume
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Backup ¶
Backup writes a tar.zst archive of every compose-declared volume on the service. `tag`, if non-empty, is embedded in the filename for later identification. Returns the absolute paths of the created archives, one per volume.
Caller is responsible for the pre-check (service down). Backup itself runs unconditionally — the caller decides whether to enforce the safety guard.
func Clear ¶
Clear destroys every volume on the service. When noBackup is false (the default), takes an auto-backup first so undo is one `restore --previous` away. With noBackup=true, deletion is irreversible.
Caller is responsible for the pre-check (service down).
func PodmanVolumeName ¶
PodmanVolumeName returns the podman-namespaced volume name from a bare compose volume name, following the per-stack convention `<stack>_<service>_<volume>`.
func Restore ¶
Restore replaces each volume's contents with a backup archive. `from` selects the archive timestamp; empty means "latest backup for each volume" (the most recent .tar.zst by mtime in the per-volume dir).
Validates the archive (decompress sanity-check) before touching any volume. Returns the list of restored volume names.
Types ¶
type Volume ¶
type Volume struct {
Name string // bare name (without stack/service prefix)
FullName string // podman volume name (`<stack>_<service>_<name>`)
Service string
Stack string
SizeBytes int64 // 0 if volume doesn't exist yet
BackupCount int32 // archives in our backups dir
Exists bool // does the podman volume actually exist?
}
Volume is a list-row for `volume list`.