Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checker ¶
type Checker 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 }
Checker represents logic of making the health check.
type DisabledChecker ¶
type DisabledChecker struct{}
DisabledChecker implements Checker interface simply returns error value of passed context.
func NewDisabledChecker ¶
func NewDisabledChecker() *DisabledChecker
NewDisabledChecker returns a pointer to a new instance of DisabledChecker struct.
type MultiChecker ¶
type MultiChecker struct {
// contains filtered or unexported fields
}
MultiChecker takes several health checker and performs health checks for each of them concurrently.
func NewMultiChecker ¶
func NewMultiChecker(hcs ...Checker) *MultiChecker
NewMultiChecker takes several health checkers and performs health checks for each of them concurrently.
func (*MultiChecker) Add ¶
func (c *MultiChecker) Add(hc Checker)
Add appends health Checker to internal slice of HealthCheckers.
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 ¶
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.