Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterHealthCheck ¶
func RegisterHealthCheck(hc HealthCheck, name string)
RegisterHealthCheck registers a HealthCheck that need to be routed. The name must be unique. If the health check satisfies the Initialisable interface, it is initialised before it is added.
Types ¶
type ConnectionState ¶
type ConnectionState struct {
// contains filtered or unexported fields
}
ConnectionState caches the result of health checks. It is concurrency-safe.
func (*ConnectionState) GetState ¶
func (cs *ConnectionState) GetState() (bool, error)
GetState returns the current state. That is whether the check is healthy or the error occured.
func (*ConnectionState) LastChecked ¶
func (cs *ConnectionState) LastChecked() time.Time
LastChecked returns the time that the state was last updated or confirmed.
func (*ConnectionState) SetErrorState ¶
func (cs *ConnectionState) SetErrorState(err error)
SetErrorState sets the state to not healthy.
func (*ConnectionState) SetHealthy ¶
func (cs *ConnectionState) SetHealthy()
SetHealthy sets the state to healthy.
type HealthCheck ¶
HealthCheck is a health check that is initialised once and that is performed periodically and/or spontaneously.
type Initialisable ¶
type Initialisable interface {
Init() error
}
Click to show internal directories.
Click to hide internal directories.