execution

package
v0.0.367 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 19 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 ComputedValue added in v0.0.100

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

func Execute

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

func ExecuteExt added in v0.0.100

func ExecuteExt(ctx context.Context, actionName string, g *Plan, channelHandler WaitHandler, opts ExecuteOpts, injected ...MakeInjectionInstance) 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, actionName string, opts ExecuteOpts, g *Plan, injected ...MakeInjectionInstance) 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

Types

type ExecuteOpts added in v0.0.100

type ExecuteOpts struct {
	ContinueOnErrors    bool
	OrchestratorVersion int32

	WrapWithActions bool
	TaskMake        func(*schema.SerializedInvocation) *tasks.ActionEvent
	TaskTracer      trace.Tracer
	TaskOnDone      tasks.OnDoneFunc

	OnWaiter func(context.Context, Waiter)
}

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
}

func (InjectionInstance) MakeInjection added in v0.0.100

func (ij InjectionInstance) MakeInjection() []InjectionInstance

type Input

type Input struct {
	Message  proto.Message
	Instance any
}

type Inputs

type Inputs map[string]Input

type MakeInjectionInstance added in v0.0.100

type MakeInjectionInstance interface {
	MakeInjection() []InjectionInstance
}

func FromContext added in v0.0.100

func FromContext(env cfg.Context) MakeInjectionInstance

type MakeInjectionInstanceFunc added in v0.0.100

type MakeInjectionInstanceFunc func() []InjectionInstance

func (MakeInjectionInstanceFunc) MakeInjection added in v0.0.100

func (m MakeInjectionInstanceFunc) MakeInjection() []InjectionInstance

type Output

type Output struct {
	InstanceID string
	Message    proto.Message
	Instance   any
}

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