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" doc:"When the run ended."`
Error string `json:"error" doc:"Why the run failed."`
}
Failure is a failed run: when it ended and its error.
type Inputs ¶
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 ¶
New builds a Runner and registers its instruments; a Target without a Sealer, or with a time not positive, is fault.Invalid.
func (*Runner) Recorder ¶
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.
type Status ¶
type Status struct {
Enabled bool `json:"enabled" doc:"True when funcd runs the platform backup, which needs backup.target and storage.mode file."`
Held bool `` /* 245-byte string literal not displayed */
RPORisk bool `` /* 194-byte string literal not displayed */
Interval v1.Duration `json:"interval" doc:"How often the platform backup runs: backup.interval; 0s when funcd runs no backup."`
RPO v1.Duration `json:"rpo" doc:"The most data that a loss may take: backup.objectives.rpo; 0s when funcd runs no backup."`
LastFailure *Failure `json:"lastFailure,omitempty" doc:"The last run that failed since funcd started; a run that succeeds clears it."`
LastSuccessTime *v1.Timestamp `json:"lastSuccessTime,omitempty" doc:"When the newest complete generation on the target was written."`
LastVerifiedTime *v1.Timestamp `` /* 173-byte string literal not displayed */
EarliestRestorePoint *v1.Timestamp `json:"earliestRestorePoint,omitempty" doc:"When the oldest generation that funcd restore run can load was written."`
NextRunTime *v1.Timestamp `json:"nextRunTime,omitempty" doc:"When the next run is due."`
Streams map[string]Stream `` /* 151-byte string literal not displayed */
}
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" doc:"When the stream's last run that succeeded ended."`
LastFailure *Failure `json:"lastFailure,omitempty" doc:"The stream's last run that failed; a run that succeeds clears it."`
}
Stream is what a sibling backup reported through Recorder since the start.