summaryrefslogtreecommitdiff
path: root/state.go
blob: c02ae7e729e6413250f280b5839d40f2452f2cb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package roadrunner

// State is current state int.
type State int

const (
	// StateInactive - no associated process
	StateInactive State = iota
	// StateBooting - relay attached but w.Start() not executed
	StateBooting
	// StateReady - ready for job.
	StateReady
	// StateWorking - working on given payload.
	StateWorking
	// StateStopped - process has been terminated
	StateStopped
	// StateError - error State (can't be used)
	StateError
)

// String returns current state as string.
func (s State) String() string {
	switch s {
	case StateInactive:
		return "inactive"
	case StateBooting:
		return "booting"
	case StateReady:
		return "ready"
	case StateWorking:
		return "working"
	case StateStopped:
		return "stopped"
	case StateError:
		return "error"
	}

	return "undefined"
}