workflow

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultActivityOptions = ActivityOptions{
	RetryOptions: DefaultRetryOptions,
}
View Source
var DefaultRetryOptions = RetryOptions{
	MaxAttempts:        3,
	BackoffCoefficient: 1,
}
View Source
var DefaultSubWorkflowOptions = SubWorkflowOptions{
	RetryOptions: DefaultRetryOptions,
}
View Source
var DefaultWorkflowExecutorCacheOptions = WorkflowExecutorCacheOptions{
	CacheDuration: 30 * time.Second,
}

Functions

func CreateSubWorkflowInstance

func CreateSubWorkflowInstance(ctx sync.Context, options SubWorkflowOptions, workflow Workflow, args ...interface{}) sync.Future

func ExecuteActivity

func ExecuteActivity(ctx sync.Context, options ActivityOptions, activity Activity, args ...interface{}) sync.Future

ExecuteActivity schedules the given activity to be executed

func NewSignalChannel

func NewSignalChannel(ctx sync.Context, name string) sync.Channel

func NewWorkflow

func NewWorkflow(workflowFn reflect.Value) *workflow

func Now

func Now(ctx sync.Context) time.Time

func Replaying

func Replaying(ctx sync.Context) bool

func ScheduleTimer

func ScheduleTimer(ctx sync.Context, delay time.Duration) sync.Future

func SetReplaying

func SetReplaying(ctx sync.Context, replaying bool)

func SideEffect

func SideEffect(ctx sync.Context, f func(ctx sync.Context) interface{}) sync.Future

func Sleep

func Sleep(ctx sync.Context, d time.Duration) error

func WithRetries

func WithRetries(ctx sync.Context, retryOptions RetryOptions, fn func(ctx sync.Context) sync.Future) sync.Future

func WorkflowInstance2

func WorkflowInstance2(ctx sync.Context) core.WorkflowInstance

Types

type Activity

type Activity interface{}

type ActivityOptions

type ActivityOptions struct {
	RetryOptions RetryOptions
}

type Registry

type Registry struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewRegistry

func NewRegistry() *Registry

func (*Registry) GetActivity

func (r *Registry) GetActivity(name string) (Activity, error)

func (*Registry) GetWorkflow

func (r *Registry) GetWorkflow(name string) (Workflow, error)

func (*Registry) RegisterActivity

func (r *Registry) RegisterActivity(activity Activity) error

func (*Registry) RegisterWorkflow

func (r *Registry) RegisterWorkflow(workflow Workflow) error

type RetryOptions

type RetryOptions struct {
	// Maximum number of times to retry
	MaxAttempts int

	// Time to wait before first retry
	FirstRetryInterval time.Duration

	// Maximum delay for any individual retry attempt
	MaxRetryInterval time.Duration

	// Coeffecient for calculation the next retry delay
	BackoffCoefficient float64

	// Timeout after which retries are aborted
	RetryTimeout time.Duration
}

type SubWorkflowOptions

type SubWorkflowOptions struct {
	InstanceID string

	RetryOptions RetryOptions
}

type Workflow

type Workflow interface{}

type WorkflowExecutor

type WorkflowExecutor interface {
	ExecuteTask(ctx context.Context, t *task.Workflow) ([]history.Event, []history.WorkflowEvent, error)

	Close()
}

func NewExecutor

func NewExecutor(registry *Registry, instance core.WorkflowInstance, clock clock.Clock) (WorkflowExecutor, error)

type WorkflowExecutorCache

type WorkflowExecutorCache interface {
	Store(ctx context.Context, instance core.WorkflowInstance, workflow WorkflowExecutor) error
	Get(ctx context.Context, instance core.WorkflowInstance) (WorkflowExecutor, bool, error)
	StartEviction(ctx context.Context)
}

type WorkflowExecutorCacheOptions

type WorkflowExecutorCacheOptions struct {
	// CacheDuration is the duration after which a workflow executor is removed from the cache.
	CacheDuration time.Duration
}

Jump to

Keyboard shortcuts

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