backupctl

package
v1.0.18 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	Svc  Service
	Jobs store.JobStore
}

Controller is the core-side implementation of extension.BackupController. It projects backup-eligible instances, reports last-success times, and enqueues backup jobs over the same path as the HTTP POST /backups handler.

func (*Controller) EnqueueBackup

func (c *Controller) EnqueueBackup(ctx context.Context, host, template, slug string) (string, error)

EnqueueBackup enqueues a backup job for one instance, deduping against any backup already queued/running/reconciling for the same instance.

func (*Controller) LastBackupAt

func (c *Controller) LastBackupAt(ctx context.Context, host, template, slug string) (time.Time, error)

LastBackupAt returns the finish time of the newest complete backup for an instance, or the zero time if none exists. ListBackups is newest-first, so the first complete row wins.

func (*Controller) ListBackupInstances

func (c *Controller) ListBackupInstances(ctx context.Context) ([]extension.BackupInstance, error)

ListBackupInstances walks every known host, lists its live instances, and returns those whose template declares at least one backup-marked volume. A per-host listing failure is logged and skipped rather than aborting the whole sweep, so one unreachable host doesn't starve backups on the others.

type Service

type Service interface {
	Hosts() []config.Host
	ListAllInstances(ctx context.Context, host string) ([]instance.Observed, error)
	GetTemplate(ctx context.Context, id string) (store.Template, error)
	ListBackups(ctx context.Context, host, template, slug string, limit int) ([]store.Backup, error)
	CheckBackupable(ctx context.Context, host, template, slug string) error
}

Service is the slice of *instance.Service the controller needs. Declaring it as an interface keeps the controller unit-testable with a fake.

Jump to

Keyboard shortcuts

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