availabilitychecks

package
v0.0.0-...-cb3ae47 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AvailabilityChecker

type AvailabilityChecker interface {
	AvailabilityCheck() error
}

AvailabilityChecker is an interface that enables implementations of AvailabilityChecker

func GetHTTPAvailabilityChecker

func GetHTTPAvailabilityChecker(c Config) (AvailabilityChecker, error)

GetHTTPAvailabilityChecker returns a HTTP implementation of the AvailabilityChecker interface.

type AvailabilityCheckers

type AvailabilityCheckers []AvailabilityChecker

AvailabilityCheckers is a slice of AvailabilityChecker

func GetAvailabilityCheckers

func GetAvailabilityCheckers(availCfg *ExtDependencyAvailabilityCheck) (AvailabilityCheckers, error)

GetAvailabilityCheckers returns a GetAvailabilityCheckers containing configured GetAvailabilityChecker

type Config

type Config interface{}

Config is an interface type used for AvailabilityChecker config

type ExtDependencyAvailabilityCheck

type ExtDependencyAvailabilityCheck struct {
	HTTP HTTPTargets `yaml:"http"`
}

ExtDependencyAvailabilityCheck holds fields for external dependencies

func (*ExtDependencyAvailabilityCheck) GetTimeoutDuration

func (e *ExtDependencyAvailabilityCheck) GetTimeoutDuration() time.Duration

GetTimeoutDuration returns the timeout duration from the ExtDependencyAvailabilityCheck type

type HTTPAvailabilityChecker

type HTTPAvailabilityChecker struct {
	Targets []string
	Timeout time.Duration
}

HTTPAvailabilityChecker type provides target and timeout fields for http checks

func (HTTPAvailabilityChecker) AvailabilityCheck

func (h HTTPAvailabilityChecker) AvailabilityCheck() error

AvailabilityCheck accepts a slice of HTTP targets accompanied by a timeout and asynchronously checks the targets to deem them available. If any of the targets are deemed unhealthy, all running routines are cancelled and an error is returned.

type HTTPConfig

type HTTPConfig struct {
	Targets []string
	Timeout time.Duration
}

HTTPConfig type provides target and timeout fields for http config

type HTTPTargets

type HTTPTargets struct {
	Timeout int      `yaml:"timeout" default:"15"`
	URLS    []string `yaml:"urls"`
}

HTTPTargets holds fields describing http targets

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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