cor

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
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 NewBaseChain(name string) *BaseChain

func (*BaseChain) AddCommand

func (c *BaseChain) AddCommand(command Command) Chain

func (*BaseChain) ContinueOnFailure

func (c *BaseChain) ContinueOnFailure(continueOnFailure bool) Chain

func (*BaseChain) Execute

func (c *BaseChain) Execute(chCtx Context)

func (*BaseChain) GetCommands

func (c *BaseChain) GetCommands() []Command

func (*BaseChain) IsExecutable

func (c *BaseChain) IsExecutable(context Context) bool

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

type Chain interface {
	Command
	ContinueOnFailure(bool) Chain
	AddCommand(command Command) 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)
}

Jump to

Keyboard shortcuts

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