Documentation
¶
Index ¶
- Constants
- type BaseChain
- type BaseCommand
- func (c *BaseCommand) GetErrorCounter() metric.Int64Counter
- func (c *BaseCommand) GetInputParam() string
- func (c *BaseCommand) GetMeter() metric.Meter
- func (c *BaseCommand) GetName() string
- func (c *BaseCommand) GetOutputParam() string
- func (c *BaseCommand) GetSuccessCounter() metric.Int64Counter
- func (c *BaseCommand) GetTracer() trace.Tracer
- func (c *BaseCommand) IsExecutable(context Context) bool
- type BaseContext
- func (c *BaseContext) Add(key string, value interface{}) Context
- func (c *BaseContext) AddError(key string, err error)
- func (c *BaseContext) AddTempFile(file string)
- func (c *BaseContext) Close()
- func (c *BaseContext) Get(key string) interface{}
- func (c *BaseContext) GetContext() context.Context
- func (c *BaseContext) GetErrors() map[string]error
- func (c *BaseContext) GetTempFiles() []string
- func (c *BaseContext) HasErrors() bool
- func (c *BaseContext) Remove(key string)
- func (c *BaseContext) SetContext(context context.Context)
- type Chain
- type Command
- type Context
- type Executable
Constants ¶
const ( CtxIn = "__IN__" CtxOut = "__OUT__" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseChain ¶
type BaseChain struct {
BaseCommand
// contains filtered or unexported fields
}
func NewBaseChain ¶
func (*BaseChain) AddCommand ¶
func (*BaseChain) ContinueOnFailure ¶
func (*BaseChain) GetCommands ¶
func (*BaseChain) IsExecutable ¶
type BaseCommand ¶
type BaseCommand struct {
Name string
InputParamName string
OutputParamName string
Tracer trace.Tracer
Meter metric.Meter
SuccessCounter metric.Int64Counter
ErrorCounter metric.Int64Counter
}
BaseCommand is the default implementation of Command
func NewBaseCommand ¶
func NewBaseCommand(name string) *BaseCommand
func (*BaseCommand) GetErrorCounter ¶
func (c *BaseCommand) GetErrorCounter() metric.Int64Counter
func (*BaseCommand) GetInputParam ¶
func (c *BaseCommand) GetInputParam() string
GetInputParam the name of the parameter expected as the primary input, if empty it will default to CtxIn, during a chain execution event CtxIn will be mapped to the previous executions CtxOut to ensure PIPE / chain behaviors.
func (*BaseCommand) GetMeter ¶
func (c *BaseCommand) GetMeter() metric.Meter
func (*BaseCommand) GetName ¶
func (c *BaseCommand) GetName() string
func (*BaseCommand) GetOutputParam ¶
func (c *BaseCommand) GetOutputParam() string
GetOutputParam the name of the output parameter, the default is CtxOut See the chain execute method for more detail.
func (*BaseCommand) GetSuccessCounter ¶
func (c *BaseCommand) GetSuccessCounter() metric.Int64Counter
func (*BaseCommand) GetTracer ¶
func (c *BaseCommand) GetTracer() trace.Tracer
func (*BaseCommand) IsExecutable ¶
func (c *BaseCommand) IsExecutable(context Context) bool
IsExecutable a default implementation of IsExecutable.
type BaseContext ¶
type BaseContext struct {
// contains filtered or unexported fields
}
func (*BaseContext) Add ¶
func (c *BaseContext) Add(key string, value interface{}) Context
func (*BaseContext) AddError ¶
func (c *BaseContext) AddError(key string, err error)
func (*BaseContext) AddTempFile ¶
func (c *BaseContext) AddTempFile(file string)
func (*BaseContext) Close ¶
func (c *BaseContext) Close()
func (*BaseContext) Get ¶
func (c *BaseContext) Get(key string) interface{}
func (*BaseContext) GetContext ¶
func (c *BaseContext) GetContext() context.Context
func (*BaseContext) GetErrors ¶
func (c *BaseContext) GetErrors() map[string]error
func (*BaseContext) GetTempFiles ¶
func (c *BaseContext) GetTempFiles() []string
func (*BaseContext) HasErrors ¶
func (c *BaseContext) HasErrors() bool
func (*BaseContext) Remove ¶
func (c *BaseContext) Remove(key string)
func (*BaseContext) SetContext ¶
func (c *BaseContext) SetContext(context context.Context)
type Chain ¶
Chain is a collection of commands that ensure the serial or parallel execution of the commands. The Chain is a command and therefore inherits the principals of the command and in addition each Chain implements it's own execution strategy.
type Command ¶
type Command interface {
Executable
GetName() string
GetInputParam() string
GetOutputParam() string
IsExecutable(context Context) bool
GetTracer() trace.Tracer
GetMeter() metric.Meter
GetSuccessCounter() metric.Int64Counter
GetErrorCounter() metric.Int64Counter
}
Command is a simple interface that ensures an atomic unit of work. The principals of a Command are: 1) Atomic, 2) Testable, and 3) Thread Safe
type Context ¶
type Context interface {
SetContext(context context.Context)
GetContext() context.Context
Add(key string, value interface{}) Context
AddError(key string, err error)
GetErrors() map[string]error
Get(key string) interface{}
Remove(key string)
HasErrors() bool
AddTempFile(file string)
GetTempFiles() []string
Close()
}
Context is an opinionated runtime context for Go Lang. It's a bit more complex than other language versions due to the nature of Filesystem behaviors.
func NewBaseContext ¶
func NewBaseContext() Context
type Executable ¶
type Executable interface {
Execute(context Context)
}