Documentation ¶
Index ¶
- func Run(config *Config, actionChannel <-chan string) <-chan StateChange
- type CommandStateChange
- type CommandTransitionConfig
- type Config
- type EventConfig
- type EventConfigList
- type KillStateChange
- type KillTransitionConfig
- type LiteralEventConfig
- type RegexEventConfig
- type SignalStateChange
- type SignalTransitionConfig
- type StateChange
- type StateConfig
- type StateConfigMap
- type TimerEventConfig
- type TransitionConfig
- type TransitionConfigList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
func Run( config *Config, actionChannel <-chan string, ) <-chan StateChange
Run runs a new Runner
Types ¶
type CommandStateChange ¶
CommandStateChange sends commands to the process
type CommandTransitionConfig ¶
type CommandTransitionConfig struct { From string `json:"from"` To string `json:"to"` Command string `json:"command"` }
CommandTransitionConfig transitions with a command
type Config ¶
type Config struct { InitialState string `json:"initialState"` States StateConfigMap `json:"states"` Transitions TransitionConfigList `json:"transitions"` }
Config is the configuration for a state machine
type EventConfigList ¶
type EventConfigList []EventConfig
EventConfigList list of EventConfig
func (*EventConfigList) UnmarshalJSON ¶
func (config *EventConfigList) UnmarshalJSON( data []byte, ) ( err error, )
UnmarshalJSON provides custom unmarshalling
type KillStateChange ¶
type KillStateChange struct {
NextState string
}
KillStateChange kills the process
type KillTransitionConfig ¶
KillTransitionConfig transitions by killing the process
type LiteralEventConfig ¶
type LiteralEventConfig struct { NextState string `json:"nextState"` Value string `json:"value"` IgnoreCase bool `json:"ignoreCase"` }
LiteralEventConfig configures literal events
type RegexEventConfig ¶
RegexEventConfig configures regex events
func (*RegexEventConfig) UnmarshalJSON ¶
func (target *RegexEventConfig) UnmarshalJSON( data []byte, ) ( err error, )
UnmarshalJSON provides custom unmarshalling
type SignalStateChange ¶
SignalStateChange sends a signal to the process
type SignalTransitionConfig ¶
type SignalTransitionConfig struct { From string `json:"from"` To string `json:"to"` Signal os.Signal `json:"signal"` }
SignalTransitionConfig transitions with a signal
func (*SignalTransitionConfig) UnmarshalJSON ¶
func (target *SignalTransitionConfig) UnmarshalJSON( data []byte, ) ( err error, )
UnmarshalJSON provides custom unmarshalling
type StateConfig ¶
type StateConfig struct {
Events EventConfigList `json:"events"`
}
StateConfig is a transition from one state to another.
type TimerEventConfig ¶
TimerEventConfig configures timer events
func (*TimerEventConfig) UnmarshalJSON ¶
func (target *TimerEventConfig) UnmarshalJSON( data []byte, ) ( err error, )
UnmarshalJSON provides custom unmarshalling
type TransitionConfig ¶
type TransitionConfig interface{}
TransitionConfig is a transition from one state to another.
type TransitionConfigList ¶
type TransitionConfigList []TransitionConfig
TransitionConfigList list of TransitionConfig
func (*TransitionConfigList) UnmarshalJSON ¶
func (config *TransitionConfigList) UnmarshalJSON( data []byte, ) ( err error, )
UnmarshalJSON provides custom unmarshalling