status

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package status is the commands that report on anfra itself: version, and status of the warm server and its sidecars.

Index

Constants

This section is empty.

Variables

View Source
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.

View Source
var Version = command.Define(command.Def[command.NoInput, VersionResult]{
	Name:     "version",
	Short:    "Print the anfra version",
	ReadOnly: true,

	Run: func(_ context.Context, cc command.CommandContext, _ command.NoInput) (VersionResult, error) {
		r := VersionResult{Version: meta.Version}
		if cc.Update != nil {
			r.Update = cc.Update()
		}
		return r, nil
	},
})

Version prints the anfra version.

Functions

This section is empty.

Types

type SidecarHealth

type SidecarHealth struct {
	Node       string `json:"node"`
	CanalQuery string `json:"canal-query"`
}

SidecarHealth is each sidecar's health: "ok" or the error message.

type State

type State string

State is the warm server's state.

const (
	// StateHealthy: the server is running, and every sidecar answers.
	StateHealthy State = "healthy"
	// StateDegraded: the server is running, and a sidecar does not answer.
	StateDegraded State = "degraded"
	// StateNotRunning: no warm server.
	StateNotRunning State = "not_running"
)

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 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"`
}

VersionResult is the `version` result.

Jump to

Keyboard shortcuts

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