preflight

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package preflight validates the runtime environment before any restore operation begins. Its job is to fail fast: if Docker, restic, environment variables, or secret files are missing or misconfigured, we must abort before touching the backup.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasFailures

func HasFailures(results []Result) bool

HasFailures reports whether any result has StatusFail.

func Print

func Print(w io.Writer, results []Result)

Print writes each result on its own line to w.

Types

type Checker

type Checker struct {
	Contract *contract.Contract
	Logger   *slog.Logger
}

Checker runs all preflight checks against a contract.

func New

func New(c *contract.Contract) *Checker

New creates a Checker for the given contract.

func (*Checker) RunAll

func (c *Checker) RunAll(ctx context.Context) []Result

RunAll executes every preflight check and returns the results in order. It always returns all results, even if some fail — the caller decides whether to abort based on HasFailures.

type Result

type Result struct {
	Name    string
	Status  Status
	Message string
	Err     error
}

Result is the outcome of a single preflight check.

func (Result) String

func (r Result) String() string

String renders a Result in a single human-readable line.

type Status

type Status string

Status represents the outcome of a single preflight check.

const (
	StatusPass    Status = "PASS"
	StatusFail    Status = "FAIL"
	StatusWarn    Status = "WARN"
	StatusSkipped Status = "SKIP"
)

Jump to

Keyboard shortcuts

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