-
Notifications
You must be signed in to change notification settings - Fork 4
/
status.go
24 lines (20 loc) · 739 Bytes
/
status.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package supervisor
// Status models the current status of a service.
type Status uint8
//go:generate stringer -type Status -trimprefix Status
const (
// StatusIdle is when a service is waiting to be scheduled by the OS scheduler.
StatusIdle Status = iota
// StatusRunning is when a service is running and everything is a-OK.
StatusRunning
// StatusStopped is when a service has stopped without without an error.
StatusStopped
// StatusError is when a service has stopped with an error.
StatusError
// StatusPanic is when a service has stopped with a runtime panic.
StatusPanic
)
// IsAlive returns true for statuses indicating that the service is currently alive.
func (s Status) IsAlive() bool {
return s < StatusStopped
}