nodebackup

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 19 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 (
	StatusPending   = "pending"
	StatusRunning   = "running"
	StatusCompleted = "completed"
	StatusFailed    = "failed"
)

Variables

This section is empty.

Functions

func Create

func Create(ctx context.Context, info *Info) error

Create builds a node backup archive synchronously.

func Delete

func Delete(id string) error

Delete removes archive and metadata for a backup UUID.

func EnsureDirectory

func EnsureDirectory() error

EnsureDirectory creates the node backup directory if missing.

func Restore

func Restore(ctx context.Context, id string) error

Restore extracts a completed node backup archive onto the host paths.

func RestoreFile

func RestoreFile(ctx context.Context, archive string, mode Mode) error

RestoreFile extracts an archive path using mode hints from backup_info when possible.

func WriteMeta

func WriteMeta(info *Info) error

WriteMeta persists backup metadata next to the archive.

Types

type Info

type Info struct {
	UUID        string    `json:"uuid"`
	Mode        Mode      `json:"mode"`
	Status      string    `json:"status"`
	Filename    string    `json:"filename"`
	Path        string    `json:"path"`
	Bytes       int64     `json:"bytes"`
	Checksum    string    `json:"checksum,omitempty"`
	Error       string    `json:"error,omitempty"`
	CreatedAt   time.Time `json:"created_at"`
	CompletedAt time.Time `json:"completed_at,omitempty"`
	Migration   bool      `json:"migration,omitempty"`
}

Info describes a node backup archive on disk.

func List

func List() ([]Info, error)

List returns all known node backups (meta files), newest first.

func NewPending

func NewPending(mode Mode, migration bool) (*Info, error)

NewPending allocates a pending backup record.

func ReadMeta

func ReadMeta(id string) (*Info, error)

ReadMeta loads metadata for a backup UUID.

type JobManager

type JobManager struct {
	// contains filtered or unexported fields
}

JobManager tracks in-flight and recent node backup jobs.

func Default

func Default() *JobManager

Default returns the process-wide job manager.

func (*JobManager) ActiveUUID

func (m *JobManager) ActiveUUID() string

ActiveUUID returns the currently running backup UUID, if any.

func (*JobManager) Cancel

func (m *JobManager) Cancel()

Cancel aborts the active job if any.

func (*JobManager) SetStopper

func (m *JobManager) SetStopper(s ServerStopper)

SetStopper attaches the server manager used to quiesce instances.

func (*JobManager) StartCreate

func (m *JobManager) StartCreate(ctx context.Context, mode Mode, migration bool, quiesce bool) (*Info, error)

StartCreate begins an async node backup. Returns the pending Info.

type Mode

type Mode string

Mode selects what is included in a node-level archive.

const (
	ModeUserBackupsOnly Mode = "user_backups_only"
	ModeFull            Mode = "full"
	ModeVolumes         Mode = "volumes"
)

func ValidateMode

func ValidateMode(mode string) (Mode, error)

ValidateMode returns a normalized mode or an error.

type ServerStopper

type ServerStopper interface {
	All() []*server.Server
}

ServerStopper stops servers before a full/volumes node backup.

Jump to

Keyboard shortcuts

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