fatal

package
v0.175.0-rc.310 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package fatal owns the persistent, machine-local outage queue. It deliberately does not depend on the supervisor, hooks, board or main configuration loader.

Index

Constants

View Source
const File = "fatal.json"

Variables

This section is empty.

Functions

This section is empty.

Types

type Incident

type Incident struct {
	ID          string    `json:"id"`
	Evidence    string    `json:"evidence"`
	Owner       string    `json:"owner,omitempty"`
	Opened      time.Time `json:"opened"`
	Resolved    time.Time `json:"resolved,omitzero"`
	LastAttempt time.Time `json:"lastAttempt,omitzero"`
	Attempts    int       `json:"attempts"`
	Outcome     string    `json:"outcome,omitempty"`
}

Incident survives restarts. Only a successful probe resolves an outage; finishing a repair session never does. Attempts are reserved before launch.

type Observation

type Observation struct {
	ID, Evidence              string
	Failed, Unknown, Disabled bool
}

Observation distinguishes a failed probe from one that could not run, and from a component deliberately disabled by its owner.

type Queue

type Queue struct {
	Incidents []Incident `json:"incidents"`
}

func Read

func Read(dir string) (Queue, error)

func (Queue) Barrier

func (q Queue) Barrier(name string) error

Barrier leaves existing work running, admitting only the reserved repair owner while an outage stands. A display name cannot grant stop/hold bypass.

func (*Queue) Observe

func (q *Queue) Observe(o Observation, now time.Time) string

Observe returns a transition message, empty for a repeated observation. Unknown never clears a known outage. Disabled explicitly withdraws it.

func (*Queue) Reserve

func (q *Queue) Reserve(now time.Time, live func(string) bool) *Incident

Reserve chooses at most one repair, with a global owner and a bounded retry budget. A live owner blocks every other repair, even after its cooldown.

func (Queue) Save

func (q Queue) Save(dir string) error

Save atomically publishes the admission barrier before any repair starts. The caller must hold fatal.lock for the entire reconciliation.

Jump to

Keyboard shortcuts

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