health

package
v0.0.0-...-8223eb1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Critical = HealthState("critical")
	Unknown  = HealthState("unknown")
	Warning  = HealthState("warning")
	Passing  = HealthState("passing")
)

String representations of the canonical health states

Functions

func Compare

func Compare(a, b HealthState) int

Compare two HealthStates. Return 0 if equal, a value less than 0 if a < b and a value greater than 0 if a > b. The ordering is Passing > Warning > Unknown > Critical.

Types

type HealthState

type HealthState string

func ToHealthState

func ToHealthState(str string) HealthState

ToHealthState converts a string to its corresponding HealthState value. Unrecognized values become Unknown.

func (HealthState) Int

func (s HealthState) Int() int

Int converts a HealthState to an enum representation suitable for comparisons.

func (HealthState) Is

func (s HealthState) Is(state string) bool

Returns whether the given string matches a particular health state

type Result

type Result struct {
	ID      types.PodID
	Node    types.NodeName
	Service string
	Status  HealthState
}

Result stores the health state of a service.

func MaxResult

func MaxResult(r1 Result, rest ...Result) Result

MaxResult is a shortcult that builds a ResultList from the inputs and calls ResultList.MaxValue() on it.

func MinResult

func MinResult(r1 Result, rest ...Result) Result

MinResult is a shortcut that builds a ResultList from the inputs and calls ResultList.MinValue() on it.

type ResultList

type ResultList []Result

ResultList is a type alias that adds some extra methods that operate on the list.

func (ResultList) MaxValue

func (l ResultList) MaxValue() *Result

MaxValue returns a pointer to a Result with the best health status in the list. If the list is empty, returns nil.

func (ResultList) MinValue

func (l ResultList) MinValue() *Result

MinValue returns a pointer to a Result with the worst health status in the list. If the list is empty, returns nil.

type SortOrder

type SortOrder struct {
	Nodes  []types.NodeName
	Health map[types.NodeName]Result
}

SortOrder sorts the nodes in the list from least to most health.

func (SortOrder) Len

func (s SortOrder) Len() int

func (SortOrder) Less

func (s SortOrder) Less(i, j int) bool

func (SortOrder) Swap

func (s SortOrder) Swap(i, j int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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