Documentation ¶
Index ¶
- func ShortID() string
- type IncludeAction
- type Input
- type LoadAction
- type LocalProcess
- func (l *LocalProcess) Action() force.Action
- func (l *LocalProcess) Channel() force.Channel
- func (l *LocalProcess) Done() <-chan struct{}
- func (l *LocalProcess) Eval(ctx force.ExecutionContext) (interface{}, error)
- func (l *LocalProcess) Events() chan<- force.Event
- func (l *LocalProcess) Group() force.Group
- func (l *LocalProcess) MarshalCode(ctx force.ExecutionContext) ([]byte, error)
- func (l *LocalProcess) Name() string
- func (l *LocalProcess) Start(ctx force.ExecutionContext) error
- func (l *LocalProcess) String() string
- func (l *LocalProcess) Type() interface{}
- type NewProcess
- type NewSetupProcess
- type Runner
- func (r *Runner) AddChannel(e force.Channel)
- func (r *Runner) AddProcess(p force.Process)
- func (r *Runner) BroadcastEvents() chan<- force.Event
- func (r *Runner) Close() error
- func (r *Runner) Context() context.Context
- func (r *Runner) Done() <-chan struct{}
- func (r *Runner) ExitEvent() force.ExitEvent
- func (r *Runner) GetPlugin(key interface{}) (interface{}, bool)
- func (r *Runner) IsDebug() bool
- func (r *Runner) Logger() force.Logger
- func (r *Runner) Oneshot(name string, actions ...force.Action) (force.Process, error)
- func (r *Runner) OneshotWithExit(actions ...force.Action) (force.Process, error)
- func (r *Runner) Process(spec force.Spec) (force.Process, error)
- func (r *Runner) ProcessCount() int
- func (r *Runner) RemoveRunner(name string, in *Runner) bool
- func (r *Runner) SetPlugin(key interface{}, val interface{})
- func (r *Runner) Setup(actions ...force.Action) (force.Process, error)
- func (r *Runner) Start()
- func (r *Runner) String() string
- func (r *Runner) SwapRunner(name string, in *Runner) *Runner
- type Script
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type IncludeAction ¶
type IncludeAction struct {
// contains filtered or unexported fields
}
IncludeAction runs shell script
func (*IncludeAction) Eval ¶
func (s *IncludeAction) Eval(ctx force.ExecutionContext) (interface{}, error)
Eval runs shell script and returns output as a string
func (*IncludeAction) MarshalCode ¶
func (s *IncludeAction) MarshalCode(ctx force.ExecutionContext) ([]byte, error)
MarshalCode marshals action into code representation
func (*IncludeAction) String ¶
func (s *IncludeAction) String() string
func (*IncludeAction) Type ¶
func (s *IncludeAction) Type() interface{}
type Input ¶
type Input struct { // ID specifies run ID ID string // Setup is an optional setup script to parse // it sets up a group of processes Setup Script // Script is a script to parse Script Script // Context is a global context Context context.Context // Debug turns on global debug mode Debug bool }
Input is an input to parser
func (*Input) CheckAndSetDefaults ¶
CheckAndSetDefaults checks and sets default values
type LoadAction ¶
type LoadAction struct {
// contains filtered or unexported fields
}
LoadAction
func (*LoadAction) Eval ¶
func (s *LoadAction) Eval(ctx force.ExecutionContext) (interface{}, error)
Eval runs shell script and returns output as a string
func (*LoadAction) MarshalCode ¶
func (s *LoadAction) MarshalCode(ctx force.ExecutionContext) ([]byte, error)
MarshalCode marshals action into code representation
func (*LoadAction) String ¶
func (s *LoadAction) String() string
func (*LoadAction) Type ¶
func (s *LoadAction) Type() interface{}
type LocalProcess ¶
LocalProcess implements a process interface
func NewLocalProcess ¶
func NewLocalProcess(ctx context.Context, logger force.Logger, spec force.Spec) (*LocalProcess, error)
NewLocalProcess starts a new local process in the future we may support remote processes, e.g. K8s process?
func (*LocalProcess) Action ¶
func (l *LocalProcess) Action() force.Action
func (*LocalProcess) Channel ¶
func (l *LocalProcess) Channel() force.Channel
EventSource returns channel
func (*LocalProcess) Done ¶
func (l *LocalProcess) Done() <-chan struct{}
Done returns a channel that signals that process has completed handling channel events and exited
func (*LocalProcess) Eval ¶
func (l *LocalProcess) Eval(ctx force.ExecutionContext) (interface{}, error)
func (*LocalProcess) Events ¶
func (l *LocalProcess) Events() chan<- force.Event
func (*LocalProcess) Group ¶
func (l *LocalProcess) Group() force.Group
Runner returns a process group this process belongs to
func (*LocalProcess) MarshalCode ¶
func (l *LocalProcess) MarshalCode(ctx force.ExecutionContext) ([]byte, error)
func (*LocalProcess) Start ¶
func (l *LocalProcess) Start(ctx force.ExecutionContext) error
func (*LocalProcess) String ¶
func (l *LocalProcess) String() string
String returns process user friendly string
func (*LocalProcess) Type ¶
func (l *LocalProcess) Type() interface{}
type NewProcess ¶
type NewProcess struct {
// contains filtered or unexported fields
}
NewProcess is a function that creates a new process
func (*NewProcess) NewInstance ¶
func (n *NewProcess) NewInstance(group force.Group) (force.Group, interface{})
NewInstance returns a new instance of the process
type NewSetupProcess ¶
type NewSetupProcess struct {
// contains filtered or unexported fields
}
NewSetupProcess creates new setup process
func (*NewSetupProcess) NewInstance ¶
func (n *NewSetupProcess) NewInstance(group force.Group) (force.Group, interface{})
NewInstance returns a new instance of a function that does nothing but grouping methods together
type Runner ¶
Runner listens for events and launches processes
func Parse ¶
Parse parses golang-like expressions, for example:
Infof("hello")
And calls registered function "Infof" with argument "hello", however, Infof does not immediatelly log the "hello" message, instead it returns LogAction{Message: "hello"}, essentially
translating golang syntax into a tree of actions to interpret, like a high level virtual machine, for example
func(){ a := "hello" Infof(a) }()
becomes:
LambdaFunctionCall{ LambdaFunction{ Statements: { DefineAction{Name: "a", Value: "hello"}, InfofAction{Format: VariableReference{Name: "a"}} } } // called with no args Args: {} }
func (*Runner) AddChannel ¶
func (*Runner) AddProcess ¶
func (*Runner) BroadcastEvents ¶
BroadcastEvents will broadcast events to every process in a process group
func (*Runner) GetPlugin ¶
GetPlugin returns a process group local variable all setters and getters are thread safe
func (*Runner) Logger ¶
Logger returns a logger associated with this runner if the plugin is set, it will use the plugin to instantiate the logger
func (*Runner) OneshotWithExit ¶
OneshotWithExit creates a oneshot process that wraps actions and exits
func (*Runner) ProcessCount ¶
func (*Runner) RemoveRunner ¶
RemoveRunner removes the runner if it matches the passed runner pointer (to avoid removing new runner)
func (*Runner) SetPlugin ¶
func (r *Runner) SetPlugin(key interface{}, val interface{})
SetPlugin sets process group-local variable all setters and getters are thread safe