runner

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package runner runs the platform backup (ADR-0205): one run at a time, on a cadence anchored on the newest complete ladder generation; a status read from the target's listing; the funcd.backup metrics; and the rpoRisk alert on the newest verified generation. The blob mirror (ADR-0208) and the KV export (ADR-0209) report their runs to Recorder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Target backup.Target
	Sealer *envelope.Sealer
	Hold   interface{ Held() bool }
	Times  config.BackupTimes
	Meter  metric.Meter
	Logger *slog.Logger
	Clock  clock.Clock
	After  func(time.Duration) <-chan time.Time
}

Config builds a Runner. Target nil runs no platform backup (the streams only); Hold nil is never held (ADR-0206); Meter nil records nothing; Clock nil is the system clock; After nil is time.After.

type Failure

type Failure struct {
	Time  v1.Timestamp `json:"time"`
	Error string       `json:"error"`
}

Failure is a failed run: when it ended and its error.

type Inputs

type Inputs struct {
	Events, Meta, Runs snapshot.Source
	Parent             *backup.GenRef
}

Inputs are the stores a run cuts (ADR-0202) and the generation a restore loaded (ADR-0206), nil at a first start.

type Runner

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

Runner runs the platform backup and keeps its status in memory.

func New

func New(cfg Config) (*Runner, error)

New builds a Runner and registers its instruments; a Target without a Sealer, or with a time not positive, is fault.Invalid.

func (*Runner) Bind

func (r *Runner) Bind(in Inputs) error

Bind sets the stores a run cuts; a Target with a nil Source is fault.Invalid.

func (*Runner) Recorder

func (r *Runner) Recorder(stream string) func(start time.Time, err error)

Recorder returns the report function of a sibling backup stream ("blob", "kv"): a nil error is a success at the call, else a failure; either is counted.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context)

Run runs the platform backup until ctx ends, at once without a Target (Decision 2). A failed run is logged, counted and kept in the status; the next attempt follows retryInterval later.

func (*Runner) Status

func (r *Runner) Status(ctx context.Context) (Status, error)

Status lists the Target and returns the status; a failed listing returns the last one with fault.Unavailable.

type Status

type Status struct {
	Enabled              bool              `json:"enabled"`
	Held                 bool              `json:"held"`
	RPORisk              bool              `json:"rpoRisk"`
	Interval             v1.Duration       `json:"interval"`
	RPO                  v1.Duration       `json:"rpo"`
	LastFailure          *Failure          `json:"lastFailure,omitempty"`
	LastSuccessTime      *v1.Timestamp     `json:"lastSuccessTime,omitempty"`
	LastVerifiedTime     *v1.Timestamp     `json:"lastVerifiedTime,omitempty"`
	EarliestRestorePoint *v1.Timestamp     `json:"earliestRestorePoint,omitempty"`
	NextRunTime          *v1.Timestamp     `json:"nextRunTime,omitempty"`
	Streams              map[string]Stream `json:"streams,omitempty"`
}

Status is the platform backup's status (Decision 4). Its times come from the target's listing, so they survive a restart; LastFailure and Streams are since the start.

type Stream

type Stream struct {
	LastSuccessTime *v1.Timestamp `json:"lastSuccessTime,omitempty"`
	LastFailure     *Failure      `json:"lastFailure,omitempty"`
}

Stream is what a sibling backup reported through Recorder since the start.

Jump to

Keyboard shortcuts

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