backup

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AtomicDownload added in v1.6.0

func AtomicDownload(dest string, expectedSize int64, fn func(io.Writer) (int64, error)) (int64, error)

AtomicDownload writes via fn(w) to dest+".partial" and atomically renames it to dest on success. If expectedSize is non-negative and the bytes written don't match, the partial is removed and an error is returned. On any error path the partial is removed so retention/listing can never see a truncated backup as the latest file.

func Execute

func Execute(ctx context.Context, cfg config.BackupConfig, store *storage.Manager, opts Options) error

Execute runs cfg through its provider with retry/backoff. Every failed attempt is logged to status.json (with Attempt set); the final successful attempt records a success row. A retry.Permanent error from a provider short-circuits the loop. Dry runs skip retry entirely.

Types

type HAProvider

type HAProvider struct{}

func (*HAProvider) Run

func (p *HAProvider) Run(ctx context.Context, cfg config.BackupConfig, store *storage.Manager, opts Options) (Result, error)

type LocalProvider added in v1.5.0

type LocalProvider struct{}

func (*LocalProvider) Run added in v1.5.0

func (p *LocalProvider) Run(ctx context.Context, cfg config.BackupConfig, store *storage.Manager, opts Options) (Result, error)

type Options

type Options struct {
	DryRun bool
	// NoRetry forces a single attempt with no backoff. Used by interactive
	// CLI commands (`goback run`, `goback now`) where retry would surprise
	// the user; the daemon path always retries per the configured policy.
	NoRetry bool
}

type Provider

type Provider interface {
	Run(ctx context.Context, cfg config.BackupConfig, store *storage.Manager, opts Options) (Result, error)
}

func NewProvider

func NewProvider(backupType string) (Provider, error)

type Result added in v1.6.0

type Result struct {
	Filename string
	Size     int64
}

Result is what a Provider returns on a successful run. The fields are used by Execute to record the success in status.json.

type SSHProvider

type SSHProvider struct{}

func (*SSHProvider) Run

func (p *SSHProvider) Run(ctx context.Context, cfg config.BackupConfig, store *storage.Manager, opts Options) (Result, error)

Jump to

Keyboard shortcuts

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