Documentation
¶
Overview ¶
Package status is the commands that report on anfra itself: version, and status of the warm server and its sidecars.
Index ¶
Constants ¶
const SkillsUnknown = "unknown"
SkillsUnknown is the skills arg when the version of the skills in use isn't known: a skill with no stamp, as copies from before the stamp have none.
Variables ¶
var Status = command.Define(command.Def[command.NoInput, StatusResult]{ Name: "status", Short: "Report whether a warm server is running and its sidecars are healthy", ReadOnly: true, Run: func(ctx context.Context, cc command.CommandContext, _ command.NoInput) (StatusResult, error) { r := checkStatus(ctx, cc.Clients) r.Server = cc.Server return r, nil }, Valid: func(r StatusResult) bool { return r.State == StateHealthy }, })
Status reports whether a warm server is running and its sidecars are healthy.
var Version = command.Define(command.Def[VersionInput, VersionResult]{ Name: "version", Short: "Print the anfra version, and say when anfra or the anfra skills are behind", ReadOnly: true, Check: checkVersion, Run: func(_ context.Context, cc command.CommandContext, in VersionInput) (VersionResult, error) { return runVersion(cc, in, time.Now()), nil }, })
Version prints the anfra version and, given the version of the anfra skills in use, compares both with the latest the host knows of, saying what to act on as hints (docs/designs/agent-setup.md). It reads only what the host cached: no network, no files.
Functions ¶
This section is empty.
Types ¶
type SidecarHealth ¶
SidecarHealth is each sidecar's health: "ok" or the error message.
type SkillsResult ¶ added in v0.15.0
type SkillsResult struct {
// Version is the skills version given; absent for unknown.
Version string `json:"version,omitempty"`
// Latest is the newest skills version known, never older than Version: they
// differ only when Version is behind. Absent when none is known yet.
Latest string `json:"latest,omitempty"`
// Checked is the date of the host's last check, when it is more than two
// days old.
Checked string `json:"checked,omitempty"`
}
SkillsResult is the anfra skills in use against the latest known.
type StatusResult ¶
type StatusResult struct {
State State `json:"state" enum:"healthy,degraded,not_running"`
Server *command.ServerInfo `json:"server,omitempty"`
Sidecars *SidecarHealth `json:"sidecars,omitempty"`
}
StatusResult is the `status` result: the warm server's state and, when it is running, where it is and its sidecars' health.
type VersionInput ¶ added in v0.15.0
type VersionInput struct {
Skills string `` /* 214-byte string literal not displayed */
}
VersionInput is the version of the anfra skills in use, to compare.
func (VersionInput) TransformSchema ¶ added in v0.15.0
type VersionResult ¶
type VersionResult struct {
Version string `json:"version"`
// Update is the newest release the host knows of; absent when it does not
// check for updates or has not checked yet.
Update *command.UpdateInfo `json:"update,omitempty"`
// Skills compares the skills version given with the latest; absent when
// none was given.
Skills *SkillsResult `json:"skills,omitempty"`
// Hints are what to act on, for an agent to follow; absent when nothing is.
Hints []string `json:"hints,omitempty"`
}
VersionResult is the `version` result. The CLI prints its keys in alphabetical order, so skills' latest: comes before update's: the skills' session hook, which reads the first latest: line as anfra's, gets skills only when it passes --skills.