Documentation ¶
Overview ¶
Package hc represents logic of making the health check.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HealthChecker ¶
type HealthChecker interface { // Health takes the context and performs the health check. // Returns nil in case of success or an error in case // of a failure. Health(ctx context.Context) error }
HealthChecker represents logic of making the health check.
type MultiChecker ¶
type MultiChecker struct {
// contains filtered or unexported fields
}
MultiChecker takes multiple health checker and performs health checks for each of them concurrently.
func NewMultiChecker ¶
func NewMultiChecker(hcs ...HealthChecker) *MultiChecker
NewMultiChecker takes several health checkers and performs health checks for each of them concurrently.
func (*MultiChecker) Add ¶ added in v0.1.3
func (c *MultiChecker) Add(hc HealthChecker)
Add appends health HealthChecker to internal slice of HealthCheckers.
type NopChecker ¶ added in v0.1.4
type NopChecker struct{}
NopChecker represents nop health checker.
func NewNopChecker ¶ added in v0.1.5
func NewNopChecker() NopChecker
NewNopChecker returns new instance of NopChecker.
type Synchronizer ¶
type Synchronizer struct {
// contains filtered or unexported fields
}
Synchronizer holds synchronization mechanics.
func (*Synchronizer) Add ¶
func (s *Synchronizer) Add(delta int)
Add wraps the sync.WaitGroup Add method.
func (*Synchronizer) Cancel ¶ added in v0.1.2
func (s *Synchronizer) Cancel()
Cancel calls underlying cancel function to cancel context, which passed to all health checks function.
func (*Synchronizer) Done ¶
func (s *Synchronizer) Done()
Done wraps the sync.WaitGroup Done method.
func (*Synchronizer) Error ¶
func (s *Synchronizer) Error() string
Error returns a string representation of underlying error. Implements builtin error interface.
func (*Synchronizer) SetError ¶
func (s *Synchronizer) SetError(err error)
SetError sets an error to the Synchronizer structure. Uses sync.Once to set error only once.
func (*Synchronizer) Wait ¶
func (s *Synchronizer) Wait()
Wait wraps the sync.WaitGroup Wait method.