fatal

package
v0.175.0-rc.526 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 7 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"
View Source
const MaxAttempts = 3

MaxAttempts bounds the repair starts of one outage episode.

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"`
	Repair      string    `json:"repair,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"`
	// StartError is why the last attempt's repair start failed (its exit
	// and error); empty while that start succeeded or is not known yet.
	StartError string `json:"startError,omitempty"`
}

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

func (Incident) MarshalJSON

func (x Incident) MarshalJSON() ([]byte, error)

func (Incident) Refusal

func (x Incident) Refusal() error

func (Incident) Repository

func (x Incident) Repository() string

Repository identifies a default-branch outage. Other incidents concern the execution infrastructure and retain the global ordinary-start barrier.

func (Incident) Scope

func (x Incident) Scope() string

Scope is derived from the incident ID, including for journals from older versions. A stored display field can never weaken admission.

func (*Incident) StartFailed

func (x *Incident) StartFailed(why string) (exhausted bool)

StartFailed records that the reserved repair's start failed with why: the attempt stays spent and the next pass retries without the cooldown. The owner's name stays, so a session that start did register is still judged live or dead before any retry. It reports whether the budget is spent.

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. Repository CI outages never prevent workers from starting, even in that repository or after failed repairs. A reserved infrastructure repair may start despite other global outages.

func (Queue) MainOutage

func (q Queue) MainOutage(repo string) (Incident, bool)

MainOutage returns the unresolved publication barrier for exactly repo.

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. The cooldown spaces repairs that started; after a failed start the next attempt is due at the next pass.

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