Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidCheck = errors.New("cannot register invalid check")
View Source
var ErrInvalidConfig = errors.New("invalid health manager configuration")
View Source
var ErrTimeout = errors.New("health check timed out with checks failing")
Functions ¶
This section is empty.
Types ¶
type HealthManager ¶
type HealthManager struct {
// contains filtered or unexported fields
}
func New ¶
func New(CheckFrequency, timeout time.Duration) (*HealthManager, error)
New returns a new HealthManager instance.
func (*HealthManager) Cleanup ¶
func (hm *HealthManager) Cleanup()
Cleanup cleans up any resources required by the health manager and any registered checks.
func (*HealthManager) GetHealth ¶
func (hm *HealthManager) GetHealth() bool
GetHealth returns the health manager's current healthy status.
func (*HealthManager) Register ¶
func (hm *HealthManager) Register(c checks.CheckInterface) error
Register registers a new check with the health manager.
func (*HealthManager) Run ¶
func (hm *HealthManager) Run() error
Run executes the registered checks until all return healthy or the timeout elapses. Runs all checks then sleeps until the check frequency elapses before re-running checks. New checks cannot be registerd whilst Run is ongoing.
Click to show internal directories.
Click to hide internal directories.