execution

package
v0.0.78 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ConfigurationInjection = Define[cfg.Configuration]("ns.configuration")
	EnvironmentInjection   = Define[*schema.Environment]("ns.schema.environment")
)
View Source
var InputsInjection = Define[Inputs]("namespace.ops.inputs")

Functions

func Compile

func Compile[M proto.Message](compiler compilerFunc)

func Execute

func Execute(ctx context.Context, config cfg.Context, actionName string, g *Plan, channelHandler WaitHandler, injected ...InjectionInstance) error

func Get

func Get[V any](ctx context.Context, inj Injection[V]) (V, error)

Get can be invoked within a serialized invocation implementation.

func RawExecute

func RawExecute(ctx context.Context, config cfg.Context, actionName string, g *Plan, injected ...InjectionInstance) error

Don't use this method if you don't have a use-case for it, use Execute.

func RegisterFuncs

func RegisterFuncs[M proto.Message](funcs Funcs[M])

func RegisterHandlerFunc

func RegisterHandlerFunc[M proto.Message](handle func(context.Context, *schema.SerializedInvocation, M) (*HandleResult, error))

func RegisterVFuncs

func RegisterVFuncs[M proto.Message, V any](funcs VFuncs[M, V])

func Serialize

func Serialize(g *Plan) *schema.SerializedProgram

func Value

func Value[M proto.Message](inv *schema.SerializedInvocation, name string) (M, error)

Types

type Funcs

type Funcs[M proto.Message] struct {
	Aliases          []string
	EmitStart        func(context.Context, *schema.SerializedInvocation, M, chan *orchestration.Event)
	Handle           func(context.Context, *schema.SerializedInvocation, M) (*HandleResult, error)
	HandleWithEvents func(context.Context, *schema.SerializedInvocation, M, chan *orchestration.Event) (*HandleResult, error)
	PlanOrder        func(context.Context, M) (*schema.ScheduleOrder, error)
}

type HandleResult

type HandleResult struct {
	Waiter  Waiter
	Outputs []Output
}

type Injection

type Injection[V any] struct {
	// contains filtered or unexported fields
}

func Define

func Define[V any](key string) Injection[V]

func (Injection[V]) With

func (inj Injection[V]) With(value V) InjectionInstance

type InjectionInstance

type InjectionInstance struct {
	// contains filtered or unexported fields
}

type Input

type Input struct {
	Message proto.Message
}

type Inputs

type Inputs map[string]Input

type Output

type Output struct {
	InstanceID string
	Message    proto.Message
}

type Plan

type Plan struct {
	// contains filtered or unexported fields
}

A plan collects a set of invocations which can then be executed as a batch.

func NewEmptyPlan

func NewEmptyPlan() *Plan

func NewPlan

func NewPlan(defs ...*schema.SerializedInvocation) *Plan

func (*Plan) Add

func (g *Plan) Add(defs ...*schema.SerializedInvocation) *Plan

func (*Plan) Definitions

func (g *Plan) Definitions() []*schema.SerializedInvocation

type VFuncs

type VFuncs[M proto.Message, V any] struct {
	Parse            func(context.Context, *schema.SerializedInvocation, M) (V, error)
	EmitStart        func(context.Context, *schema.SerializedInvocation, V, chan *orchestration.Event)
	Handle           func(context.Context, *schema.SerializedInvocation, V) (*HandleResult, error)
	HandleWithEvents func(context.Context, *schema.SerializedInvocation, V, chan *orchestration.Event) (*HandleResult, error)
	PlanOrder        func(context.Context, V) (*schema.ScheduleOrder, error)
}

type WaitHandler

type WaitHandler func(context.Context) (chan *orchestration.Event, func(context.Context) error)

type Waiter

type Waiter func(context.Context, chan *orchestration.Event) error

A waiter implementation is required to close the received channel when it's done.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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