mirror of
https://github.com/foomo/keel.git
synced 2025-10-16 12:35:34 +00:00
42 lines
755 B
Go
42 lines
755 B
Go
package healthz
|
|
|
|
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)
|
|
}
|
|
|
|
func (h healther) Close(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
|
|
}
|