local

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

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

View Source
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.

View Source
const Kind = "local"

Kind is the adapter kind.

Variables

This section is empty.

Functions

func Info

func Info() api.KindInfo

Info describes this kind of adapter for the forms that configure one (api.KindInfo, R-261).

func Warning added in v0.10.0

func Warning(loc Location, path string) string

Warning is the message for a location, or empty when it needs none.

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 New

func New() *Adapter

New returns an unconfigured adapter.

func (*Adapter) Capabilities

func (a *Adapter) Capabilities() api.BackupCapabilities

Capabilities: a filesystem expires nothing on its own.

func (*Adapter) Category

func (a *Adapter) Category() api.Category

func (*Adapter) Configure

func (a *Adapter) Configure(ctx context.Context, raw json.RawMessage) error

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) Delete

func (a *Adapter) Delete(_ context.Context, name string) error

func (*Adapter) HealthCheck

func (a *Adapter) HealthCheck(_ context.Context) error

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) Kind

func (a *Adapter) Kind() string

func (*Adapter) List

func (a *Adapter) List(_ context.Context) ([]api.StoredBundle, error)

func (*Adapter) Reader

func (a *Adapter) Reader(_ context.Context, name string) (io.ReadCloser, error)

func (*Adapter) Writer

func (a *Adapter) Writer(_ context.Context, name string) (io.WriteCloser, error)

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

func Locate(mountinfo io.Reader, path, dataDir string) Location

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL