Documentation
¶
Overview ¶
Package local stores backup bundles on a filesystem path.
The v1 backup destination (R-217). Honest about what it is: a bundle beside the install it backs up does not survive the disk failing, and R-217 says so plainly. It exists because a DR path that only works once a remote destination is configured is a DR path nobody tests, and because "recover from a recent mistake" (R-210) is served perfectly well by local disk.
Retention is Pando's here: a filesystem has no lifecycle rules, so OwnsRetention is false and core prunes (R-211).
Index ¶
- Constants
- func Info() api.KindInfo
- func Warning(loc Location, path string) string
- func Warnings(raw json.RawMessage) []string
- type Adapter
- func (a *Adapter) Capabilities() api.BackupCapabilities
- func (a *Adapter) Category() api.Category
- func (a *Adapter) Configure(ctx context.Context, raw json.RawMessage) error
- func (a *Adapter) Delete(_ context.Context, name string) error
- func (a *Adapter) HealthCheck(_ context.Context) error
- func (a *Adapter) Kind() string
- func (a *Adapter) List(_ context.Context) ([]api.StoredBundle, error)
- func (a *Adapter) Reader(_ context.Context, name string) (io.ReadCloser, error)
- func (a *Adapter) Writer(_ context.Context, name string) (io.WriteCloser, error)
- type Location
Constants ¶
const DefaultPath = "/var/lib/pando/backups"
DefaultPath is where bundles go when no path is configured: a directory on Pando's data volume, which every replica shares.
const Kind = "local"
Kind is the adapter kind.
Variables ¶
This section is empty.
Functions ¶
func Info ¶
Info describes this kind of adapter for the forms that configure one (api.KindInfo, R-261).
func Warnings ¶ added in v0.10.0
func Warnings(raw json.RawMessage) []string
Warnings says what is wrong with a configuration whose bundles would not survive Pando's container being recreated or restarted. Empty when nothing is, and when the mount table cannot be read: a warning Pando cannot back up is one people learn to ignore.
A warning, never a refusal (CLAUDE.md §4): the directory works until the container goes, and a development install may want exactly that.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter writes bundles into a directory.
func (*Adapter) Capabilities ¶
func (a *Adapter) Capabilities() api.BackupCapabilities
Capabilities: a filesystem expires nothing on its own.
func (*Adapter) Configure ¶
Configure sets the directory, and logs a warning when bundles written there would not outlive Pando's container (see Warnings). Logged rather than refused: the directory works until the container goes, so this is a warning, and warnings are never blockers.
func (*Adapter) HealthCheck ¶
HealthCheck writes and removes a probe file.
Not a stat: a directory that exists and is not writable is the failure this needs to catch, and it must be caught before the disaster rather than during it. A read-only mount reports healthy to every check that only looks.
func (*Adapter) Writer ¶
Writer creates a bundle, written to a temporary name and renamed on Close.
Atomic because a half-written bundle that looks whole is exactly the failure R-215 exists to catch, and catching it at restore time is catching it too late. A crash mid-write leaves a .partial file, which List ignores.
type Location ¶ added in v0.10.0
type Location int
Location is what a backup directory is stored on, as far as the mount table tells.
const ( // LocationUnknown: there is no mount table to read (not Linux, such as a // development build on macOS), or the path is on no mount in it. LocationUnknown Location = iota // LocationDataVolume: the same mount as Pando's data directory. The // default, and what the shipped install expects. LocationDataVolume // LocationOtherMount: a mount of its own, such as a bind-mounted host // directory. LocationOtherMount // LocationHostRoot: the root filesystem of a Pando not running in a // container, which is a real disk. LocationHostRoot // LocationContainerLayer: the container's own writable layer, which is // discarded when the container is recreated. LocationContainerLayer // LocationMemory: a tmpfs or ramfs, emptied when Pando restarts. LocationMemory )
func Locate ¶ added in v0.10.0
Locate reports what path is stored on, from a mount table in /proc/self/mountinfo's format. dataDir is Pando's data directory.
A path not mounted into Pando's container is the case this exists for: it passes the write probe when it is writable, such as /tmp, and the bundles written there are gone the next time the container is recreated.