forked from go-hep/hep
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fsm.go
49 lines (43 loc) · 825 Bytes
/
fsm.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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright 2017 The go-hep Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package fsm // import "go-hep.org/x/hep/fwk/fsm"
import (
"fmt"
)
type State int
const (
Undefined State = iota
Configuring
Configured
Starting
Started
Running
Stopping
Stopped
Offline
)
func (state State) String() string {
switch state {
case Undefined:
return "UNDEFINED"
case Configuring:
return "CONFIGURING"
case Configured:
return "CONFIGURED"
case Starting:
return "STARTING"
case Started:
return "STARTED"
case Running:
return "RUNNING"
case Stopping:
return "STOPPING"
case Stopped:
return "STOPPED"
case Offline:
return "OFFLINE"
default:
panic(fmt.Errorf("invalid fsm.State value %d", int(state)))
}
}