Documentation ¶
Overview ¶
Package controller runs Probes, reads time, receives Statuses from Probes, Command from the UI, and computes a View for the app to display.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command int
A Command is used to change the View generated by the controller, by filtering, sorting, or changing display formats.
const ( // CmdQuit is the command to quit the app CmdQuit Command = 0 // CmdFilterAll is the command to display all Statuses regardless of their Severity CmdFilterAll Command = iota // CmdFilterNotice is the command to display all Statuses with Severity notice or worse CmdFilterNotice Command = iota // CmdFilterWarning is the command to display all Statuses with Severity warning or worse CmdFilterWarning Command = iota // CmdFilterCritical is the command to display all Statuses with Severity critical CmdFilterCritical Command = iota // CmdSortLastChange is the command to display Statuses from most recent change to oldest or unknown change time CmdSortLastChange Command = iota // CmdSortSeverity is the command to display Statuses from worse Severity to best Severity. CmdSortSeverity Command = iota // CmdSortLabel is the command to display Statuses by alphabetical Label. CmdSortLabel Command = iota // CmdDurationFormat switches between displaying time or duration for Update and Change columns. CmdDurationFormat Command = iota // CmdClockChoice switches between different clocks with different formats or locations. CmdClockChoice Command = iota )
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
A Controller tracks the state of the application and outputs a View for the app to display.
func NewController ¶
func NewController( cfg configuration.ControllerConfig, prc []configuration.ProbeRunnerConfig, cmds <-chan Command, v chan<- View, quitter Quitter, ) *Controller
NewController creates a usable controller from configuration and channel spaghettis.
func (*Controller) Run ¶
func (c *Controller) Run(ctx context.Context)
Run starts the controller, which will run until the provided context is done.
type Quitter ¶
type Quitter func()
Quitter is the function to call in order to quit the app gracefully.
type Row ¶
type Row struct { ID string // not displayed, from probe Severity model.Severity // min(from probe, from configuration) Label string // from configuration Description string // from probe Update string // from probe Change string // from probe }
A Row is to be displayed in a table and is a UI representation of a Status.