keel/healthzer.go
2022-03-14 14:09:28 +01:00

38 lines
674 B
Go

package keel
import "context"
type healther struct {
handle func(context.Context) error
}
func NewHealthzerFn(handle func(context.Context) error) healther {
return healther{
handle: handle,
}
}
func (h healther) Healthz(ctx context.Context) error {
return h.handle(ctx)
}
// BoolHealthzer interface
type BoolHealthzer interface {
Healthz() bool
}
// BoolHealthzerWithContext interface
type BoolHealthzerWithContext interface {
Healthz(ctx context.Context) bool
}
// ErrorHealthzer interface
type ErrorHealthzer interface {
Healthz() error
}
// ErrorHealthzWithContext interface
type ErrorHealthzWithContext interface {
Healthz(ctx context.Context) error
}