diff options
author | Wolfy-J <[email protected]> | 2017-12-26 19:14:53 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2017-12-26 19:14:53 +0300 |
commit | e229d83dea4bbe9d0cfe6569c8fbe239690aafb9 (patch) | |
tree | 2d4887ffdb167d660b705415f0617458490d0b9f /state.go |
init
Diffstat (limited to 'state.go')
-rw-r--r-- | state.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/state.go b/state.go new file mode 100644 index 00000000..c02ae7e7 --- /dev/null +++ b/state.go @@ -0,0 +1,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" +} |