runner

package
v1.0.13-0...-818ebdc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2020 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

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

type CommandStateChange struct {
	NextState string
	Command   string
}

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 EventConfig

type EventConfig interface{}

EventConfig is the configuration for an event

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

type KillTransitionConfig struct {
	From string `json:"from"`
	To   string `json:"to"`
}

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

type RegexEventConfig struct {
	NextState string
	Regexp    *regexp.Regexp
}

RegexEventConfig configures regex events

func (*RegexEventConfig) UnmarshalJSON

func (target *RegexEventConfig) UnmarshalJSON(
	data []byte,
) (
	err error,
)

UnmarshalJSON provides custom unmarshalling

type SignalStateChange

type SignalStateChange struct {
	NextState string
	Signal    os.Signal
}

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 StateChange

type StateChange interface{}

StateChange contains information on a changes state

type StateConfig

type StateConfig struct {
	Events EventConfigList `json:"events"`
}

StateConfig is a transition from one state to another.

type StateConfigMap

type StateConfigMap map[string]StateConfig

StateConfigMap map of StateConfig

type TimerEventConfig

type TimerEventConfig struct {
	NextState string
	Interval  time.Duration
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL