checks

package
v1.6.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2023 License: MPL-2.0 Imports: 17 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Stub

func Stub(
	id structs.CheckID, kind structs.CheckMode, now int64,
	group, task, service, check string,
) *structs.CheckQueryResult

Stub creates a temporary QueryResult for the check of ID in the Pending state so we can represent the status of not being checked yet.

Types

type AllocationResults

type AllocationResults map[structs.CheckID]*structs.CheckQueryResult

AllocationResults is a view of the check_id -> latest result for group and task checks in an allocation.

type Checker

type Checker interface {
	Do(context.Context, *QueryContext, *Query) *structs.CheckQueryResult
}

Checker executes a check given an allocation-specific context, and produces a resulting structs.CheckQueryResult

func New

func New(log hclog.Logger) Checker

New creates a new Checker capable of executing HTTP and TCP checks.

type ClientResults

type ClientResults map[string]AllocationResults

ClientResults is a holistic view of alloc_id -> check_id -> latest result group and task checks across all allocations on a client.

func (ClientResults) Insert

func (cr ClientResults) Insert(allocID string, result *structs.CheckQueryResult)

type Query

type Query struct {
	Mode structs.CheckMode // readiness or healthiness
	Type string            // tcp or http

	Timeout time.Duration // connection / request timeout

	AddressMode string // host, driver, or alloc
	PortLabel   string // label or value

	Protocol string      // http checks only (http or https)
	Path     string      // http checks only
	Method   string      // http checks only
	Headers  http.Header // http checks only
	Body     string      // http checks only
}

A Query is derived from a ServiceCheck and contains the minimal amount of information needed to actually execute that check.

func GetCheckQuery

func GetCheckQuery(c *structs.ServiceCheck) *Query

GetCheckQuery extracts the needed info from c to actually execute the check.

type QueryContext

type QueryContext struct {
	ID               structs.CheckID
	CustomAddress    string
	ServicePortLabel string
	Networks         structs.Networks
	NetworkStatus    structs.NetworkStatus
	Ports            structs.AllocatedPorts

	Group   string
	Task    string
	Service string
	Check   string
}

A QueryContext contains allocation and service parameters necessary for address resolution.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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