mirror of
https://github.com/luxfi/consensus.git
synced 2026-09-24 00:26:58 +00:00
31 lines
585 B
Go
31 lines
585 B
Go
package core
|
|
|
|
import "context"
|
|
|
|
// HealthCheckable represents something that can report its health
|
|
type HealthCheckable interface {
|
|
// HealthCheck returns health information
|
|
HealthCheck(context.Context) (interface{}, error)
|
|
}
|
|
|
|
// HealthStatus represents health status
|
|
type HealthStatus int
|
|
|
|
const (
|
|
HealthUnknown HealthStatus = iota
|
|
HealthHealthy
|
|
HealthUnhealthy
|
|
)
|
|
|
|
// String returns the string representation
|
|
func (h HealthStatus) String() string {
|
|
switch h {
|
|
case HealthHealthy:
|
|
return "healthy"
|
|
case HealthUnhealthy:
|
|
return "unhealthy"
|
|
default:
|
|
return "unknown"
|
|
}
|
|
}
|