backup

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 41 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (

	// Pre update archives kept when the caller names no retention
	PreUpdateDefaultKeep = 5
	// Pre migration archives kept when the caller names no retention
	PreMigrationDefaultKeep = 5
)
View Source
const DefaultIntegrityCheckMaxBytes int64 = 2 << 30

Size above which the full integrity check yields to the header and schema probe

Variables

This section is empty.

Functions

func CreatePreMigrationBackup

func CreatePreMigrationBackup(h string, keep int) (string, error)

Full zip of a home before an agent import into backups/pre-migration-<timestamp>.zip, empty when skipped or incomplete

func CreatePreUpdateBackup

func CreatePreUpdateBackup(h string, keep int) (string, error)

Full zip of a home before an update into backups/pre-update-<timestamp>.zip, empty when skipped or incomplete

func CreatePreUpdateSnapshotsAllProfiles

func CreatePreUpdateSnapshotsAllProfiles(invokingHome string, keep *int, maxFileSize *int64) (*pyjson.Object, error)

Pre update quick snapshots of every sibling profile into its own home, mapping name to snapshot id

func CreateQuickSnapshot

func CreateQuickSnapshot(label *string, h string, keep *int, maxFileSize *int64) (string, error)

Quick snapshot of a home under the backup slot, the id or empty when nothing was captured

func ListQuickSnapshots

func ListQuickSnapshots(limit int, h string) ([]any, error)

Manifests of the newest quick snapshots up to the limit, a stub entry for an unreadable manifest

func PruneQuickSnapshots

func PruneQuickSnapshots(keep int, h string) (int, error)

Prunes the quick snapshots of a home down to keep and returns how many were deleted

func QuickSnapshotDir

func QuickSnapshotDir(snapshotID, h string) (string, error)

Directory of a restorable quick snapshot, empty for an invalid, escaping or missing id, failing where resolve fails

func QuickSnapshotRoot

func QuickSnapshotRoot(h string) string

Directory holding the quick state snapshots of a home, the home in effect when empty

func QuickStateFiles

func QuickStateFiles() []string

Critical state files and directories of a home a quick snapshot copies, as a fresh slice

func RestoreConfigModelSettingsAllProfiles

func RestoreConfigModelSettingsAllProfiles(ctx context.Context, profileSnapshots *pyjson.Object, invokingHome string) []*pyjson.Object

Config model settings safety net of every sibling profile, one result per restored profile

func RestoreConfigModelSettingsIfRewritten

func RestoreConfigModelSettingsIfRewritten(ctx context.Context, snapshotID, h string) (*pyjson.Object, error)

Restores the protected model and MoA keys an update rewrote, nil when nothing was done

func RestoreCronJobsAllProfiles

func RestoreCronJobsAllProfiles(profileSnapshots *pyjson.Object, invokingHome string) []*pyjson.Object

Cron jobs safety net of every sibling profile, one result per restored profile

func RestoreCronJobsIfEmptied

func RestoreCronJobsIfEmptied(snapshotID, h string) (*pyjson.Object, error)

Restores cron/jobs.json from the pre-update snapshot when the live file lost jobs, nil when nothing was done

func RestoreQuickSnapshot

func RestoreQuickSnapshot(ctx context.Context, snapshotID, h string) (bool, error)

Restores a whole quick snapshot offline, false when the profile is owned or any listed file is refused

func RunBackup

func RunBackup(ctx context.Context, h string, ns map[string]any, w io.Writer) (bool, error)

Zip backup of the home tree, false when the archive was written but is incomplete

func RunImport

func RunImport(ctx context.Context, h string, ns map[string]any, w io.Writer) (int, error)

Restores a backup archive into the home, exit status one for damaged archives or incomplete restores

func RunQuickBackup

func RunQuickBackup(ctx context.Context, h string, ns map[string]any, w io.Writer) (int, error)

icebath backup --quick, one quick snapshot of the home in effect and where it is stored

func SafeRestoreDB

func SafeRestoreDB(ctx context.Context, src, dst string) (bool, error)

SafeRestoreDB exposes the page restore under the destination reservation to the update auto restore

func SiblingProfileHomes

func SiblingProfileHomes(invokingHome string) [][2]string

Name and home of every other profile of this install, default for the root home, never failing

func SwapGatewayService

func SwapGatewayService(running func(context.Context) (bool, error),
	ensure func(context.Context, io.Writer, gateway.ServiceSetupOptions) (bool, error)) (restore func())

Replaces the gateway service check and start of the import revive until the returned restore runs

func SwapMemoryProviderExternalPaths

func SwapMemoryProviderExternalPaths(f func(ctx context.Context, h string) []string) (restore func())

Replaces the memory provider path collector until the returned restore runs

Types

type BackupInProgressError

type BackupInProgressError struct{ Msg string }

Another process already owns the backup slot

func (*BackupInProgressError) Error

func (e *BackupInProgressError) Error() string

func (*BackupInProgressError) PyTypeName

func (e *BackupInProgressError) PyTypeName() string

type IntegrityOptions

type IntegrityOptions struct {
	SkipHeader bool
	SkipPragma bool
	MaxBytes   *int64
}

Options of a SQLite verification, the zero value meaning header check, pragma and the default size cap

type IntegrityResult

type IntegrityResult struct {
	Valid   bool
	Message string
	Size    *int64
}

Outcome of a SQLite verification, Size nil when the file could not be stat'd

func VerifySQLiteIntegrity

func VerifySQLiteIntegrity(path string, opts IntegrityOptions) IntegrityResult

Verifies a SQLite file by size, header magic, then integrity_check or the cheap probe above the size cap

type Interrupted

type Interrupted struct{ Cause error }

Interruption of a copy by a stop request, passing every handler that catches ordinary failures

func (*Interrupted) Error

func (e *Interrupted) Error() string

func (*Interrupted) Unwrap

func (e *Interrupted) Unwrap() error

type SystemExit

type SystemExit struct{ Code int }

Process exit a backup command requests, the status the CLI returns

func (*SystemExit) Error

func (e *SystemExit) Error() string

Jump to

Keyboard shortcuts

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