backup

package
v0.14.2 Latest Latest
Warning

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

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

Documentation

Overview

Package backup runs filesystem backups from the agent into Proxmox Backup Server with gopbs, over a session the FallBCK server opened on the agent's behalf.

Index

Constants

View Source
const DefaultArchiveName = "root"

DefaultArchiveName is used for jobs with more than one backup path

Variables

This section is empty.

Functions

func ArchiveEntryNames added in v0.6.0

func ArchiveEntryNames(paths []string) (map[string]string, error)

ArchiveEntryNames decides how each backup path is named at the top of the archive when a job has several roots. Paths keep their basename (`/etc` → `etc`); when two paths share a basename, both are named after their full path with `/` replaced by `-` (`/etc/mydir` → `etc-mydir`, `/var/lib/mydir` → `var-lib-mydir`).

func CacheGroupDir added in v0.9.5

func CacheGroupDir(root, backupType, backupID string) string

CacheGroupDir returns the cache directory for a backup group under root

func Run added in v0.6.0

Run executes the backup and maps the outcome to a BackupExecutionResult

Types

type DirectOptions added in v0.6.0

type DirectOptions struct {
	Endpoint    string
	Fingerprint string
	TLSVerify   bool
	// Namespace within the datastore (configured on the target by an administrator);
	// empty means the root namespace
	Namespace string
	// APIToken in canonical user@realm!tokenid:secret form
	APIToken string
}

DirectOptions connects the agent straight to PBS (job setting direct_pbs)

type Encryption added in v0.13.0

type Encryption struct {
	Config      *pbs.CryptConfig
	Fingerprint string
}

Encryption is the per-run client-side encryption: the target's key as a gopbs configuration plus its fingerprint for logs and the run record. The key lives in memory for the run only; Wipe zeroes it afterwards.

func NewEncryption added in v0.13.0

func NewEncryption(keyB64, fingerprint string, created time.Time, masterPublicKey string) (*Encryption, error)

NewEncryption builds the run's encryption from what the server hands the agent (GET /api/v1/agents/encryption-key): the base64 key, its fingerprint and creation time, and the optional RSA master public key (PEM)

func (*Encryption) Wipe added in v0.13.0

func (e *Encryption) Wipe()

Wipe zeroes the key material once the run is over

type Options added in v0.6.0

type Options struct {
	// Session carries the snapshot identity, format and paths from the server
	Session *temporal.BackupSessionInfo
	// Dial returns a connection on which the PBS backup session is already open
	// (proxy.Dial through the FallBCK server). Ignored when Direct is set.
	Dial func(ctx context.Context, ref pbs.SnapshotRef) (net.Conn, error)
	// Direct, when set, makes gopbs connect to PBS itself with these credentials
	Direct *DirectOptions
	// Workers is the number of concurrent chunk uploads (0 = gopbs default)
	Workers int
	// ArchiveName names the pxar archive inside the snapshot (default: gopbs default)
	ArchiveName string
	// Blobs are small extra files stored in the snapshot as <name>.blob (manifests)
	Blobs []gopbs.Blob
	// Crypt encrypts the upload client-side (per-target key fetched for the run).
	// Required when Session.Encrypted is set: the run refuses to upload plaintext to
	// an encrypted target.
	Crypt *Encryption
	// OnPhase is told what the engine is doing (opening the session, uploading an
	// archive, finalizing); used for activity heartbeats and failure reporting
	OnPhase func(phase string)
	// CacheDir enables metadata change detection for v2 archives: the metadata
	// stream of every upload is kept here and, when it matches the server's previous
	// snapshot, files with unchanged metadata are not read again. Empty disables.
	CacheDir string
	// ReadPaths, when set, are read instead of Session.BackupPaths (same order): a
	// Windows job reads its paths through VSS shadow copies while the archive keeps
	// the names of the configured paths
	ReadPaths []string
	// Tree, when set, is archived instead of any paths: a caller-built virtual
	// directory (scan.KindDirectory nodes with scan.KindStream leaves, see
	// archive.Archive.AddTree) whose leaves are read on demand. Microsoft 365 units
	// present their mailbox and files this way. ArchiveName is required.
	Tree *scan.Node
}

Options for one backup run

Jump to

Keyboard shortcuts

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