feat: v0.4.0 simplify
This commit is contained in:
26
entity.go
26
entity.go
@@ -5,30 +5,11 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Status uint8
|
||||
|
||||
const (
|
||||
StatusUnknown Status = iota
|
||||
StatusOK
|
||||
StatusDown
|
||||
)
|
||||
|
||||
func (s Status) String() string {
|
||||
switch s {
|
||||
case StatusOK:
|
||||
return "OK"
|
||||
case StatusDown:
|
||||
return "DOWN"
|
||||
default:
|
||||
return "UNKNOWN"
|
||||
}
|
||||
}
|
||||
|
||||
// CheckFunc is a function that does the actual work.
|
||||
// This package provides a number of check functions but
|
||||
// any function matching the signature may be provided.
|
||||
// It must obey context dealine and cancellation.
|
||||
type CheckFunc func(context.Context) (Status, error)
|
||||
type CheckFunc func(context.Context) error
|
||||
|
||||
// Check represents a check that must be run by Watchdog.
|
||||
type Check struct {
|
||||
@@ -38,7 +19,6 @@ type Check struct {
|
||||
}
|
||||
|
||||
type CheckResult struct {
|
||||
Name string // identifier of check
|
||||
Status Status // status as retuned by CheckFunc
|
||||
Error error // error returned by CheckFunc
|
||||
Name string // identifier of check
|
||||
Error error // error returned by CheckFunc
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user