Documentation
¶
Overview ¶
Package safemode counts funcd's unclean starts in <storage.dataDir>/safemode.json and turns a crash loop into a held start, then a stop that names the operator's restore (ADR-0207 Decisions 3 to 5). It records the last funcd upgrade, whose pre-upgrade generation is the way back.
Index ¶
Constants ¶
const ExitStopped = 70
ExitStopped is the exit status of a stopped start; both units carry RestartPreventExitStatus=70.
const MarkerReason = "safe-mode"
MarkerReason is the hold marker's reason when safe mode holds the platform.
const StateFile = "safemode.json"
StateFile is the start counter in the data directory.
Variables ¶
This section is empty.
Functions ¶
func Begin ¶
Begin reads StateFile and returns the state before this start and the mode: unclean below AfterCrashes is Normal, below twice it Held, else Stopped with a nil *Start and a *StoppedError, nothing written. Otherwise the start is recorded unclean under version. An absent file is the zero state; one that does not read or decode is fault.Internal, and no start is recorded.
func RecordUpgrade ¶
RecordUpgrade records u as the last upgrade and the count as clean (Decision 1 step 6).
Types ¶
type Start ¶
type Start struct {
// contains filtered or unexported fields
}
Start is one counted start: Clean and Failed record how it ended.
type State ¶
type State struct {
Unclean int `json:"unclean"`
Version string `json:"version,omitempty"`
LastError string `json:"lastError,omitempty"`
Upgrade *Upgrade `json:"upgrade,omitempty"`
}
State is StateFile: the unclean starts in a row, the version of the last start, the error the last failed start returned, and the last upgrade.
type StoppedError ¶
type StoppedError struct{ State State }
StoppedError is a stopped start: it names the count, the last error and the next command.
func (*StoppedError) Error ¶
func (e *StoppedError) Error() string