instance

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 29 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Instance

type Instance struct {
	Tracer tracing.ITracer

	Locator      data.IFlowDataLocator
	EventIngress event.IConsumer
	EventEgress  event.ISource
	// contains filtered or unexported fields
}

func NewInstance

func NewInstance(element *schema.Process, definitions *schema.Definitions, options ...Option) (instance *Instance, err error)

func (*Instance) ConsumeEvent

func (instance *Instance) ConsumeEvent(ev event.IEvent) (result event.ConsumptionResult, err error)

func (*Instance) FlowNodeMapping

func (instance *Instance) FlowNodeMapping() *flow_node.FlowNodeMapping

func (*Instance) Id

func (instance *Instance) Id() id.Id

func (*Instance) Process added in v0.7.0

func (instance *Instance) Process() *schema.Process

func (*Instance) RegisterEventConsumer

func (instance *Instance) RegisterEventConsumer(ev event.IConsumer) (err error)

func (*Instance) StartAll

func (instance *Instance) StartAll(ctx context.Context) (err error)

StartAll explicitly starts the instance by triggering all start events, if any

func (*Instance) StartWith

func (instance *Instance) StartWith(ctx context.Context, startEvent schema.StartEventInterface) (err error)

StartWith explicitly starts the instance by triggering a given start event

func (*Instance) WaitUntilComplete

func (instance *Instance) WaitUntilComplete(ctx context.Context) (complete bool)

WaitUntilComplete waits until the instance is complete. Returns true if the instance was complete, false if the context signalled `Done`

type InstantiationTrace

type InstantiationTrace struct {
	InstanceId id.Id
}

InstantiationTrace denotes instantiation of a given process

func (InstantiationTrace) TraceInterface

func (i InstantiationTrace) TraceInterface()

type Option

type Option func(ctx context.Context, instance *Instance) context.Context

Option allows to modify configuration of an instance in a flexible fashion (as its just a modification function)

It also allows to augment or replace the context.

func WithContext

func WithContext(newCtx context.Context) Option

WithContext will pass a given context to a new instance instead of implicitly generated one

func WithDataObjects added in v0.2.3

func WithDataObjects(dataObjects map[string]any) Option

func WithEventDefinitionInstanceBuilder

func WithEventDefinitionInstanceBuilder(builder event.IDefinitionInstanceBuilder) Option

func WithEventEgress

func WithEventEgress(source event.ISource) Option

func WithEventIngress

func WithEventIngress(consumer event.IConsumer) Option

func WithIdGenerator

func WithIdGenerator(builder id.IGeneratorBuilder) Option

func WithLocator added in v0.7.0

func WithLocator(locator data.IFlowDataLocator) Option

func WithTracer

func WithTracer(tracer tracing.ITracer) Option

WithTracer overrides instance's tracer

func WithVariables

func WithVariables(variables map[string]any) Option

type Trace

type Trace struct {
	InstanceId id.Id
	Trace      tracing.ITrace
}

Trace wraps any trace with process instance id

func (Trace) TraceInterface

func (t Trace) TraceInterface()

func (Trace) Unwrap

func (t Trace) Unwrap() tracing.ITrace

Jump to

Keyboard shortcuts

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