workflow

package
v1.2.7-prerelease4 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrStaleState is the error returned during state update indicating that cached mutable state could be stale
	ErrStaleState = errors.New("cache mutable state could potentially be stale")
	// ErrMaxAttemptsExceeded is exported temporarily for integration test
	ErrMaxAttemptsExceeded = errors.New("maximum attempts exceeded to update history")
	// ErrActivityTaskNotFound is the error to indicate activity task could be duplicate and activity already completed
	ErrActivityTaskNotFound = &types.EntityNotExistsError{Message: "activity task not found"}
	// ErrNotExists is the error to indicate workflow doesn't exist
	ErrNotExists = &types.EntityNotExistsError{Message: "workflow execution already completed"}
	// ErrAlreadyCompleted is the error to indicate workflow execution already completed
	ErrAlreadyCompleted = &types.WorkflowExecutionAlreadyCompletedError{Message: "workflow execution already completed"}
	// ErrParentMismatch is the error to parent execution is given and mismatch
	ErrParentMismatch = &types.EntityNotExistsError{Message: "workflow parent does not match"}
	// ErrDeserializingToken is the error to indicate task token is invalid
	ErrDeserializingToken = &types.BadRequestError{Message: "error deserializing task token"}
	// ErrSerializingToken is the error to indicate task token can not be serialized
	ErrSerializingToken = &types.BadRequestError{Message: "error serializing task token"}
	// ErrSignalOverSize is the error to indicate signal input size is > 256K
	ErrSignalOverSize = &types.BadRequestError{Message: "signal input size is over 256K"}
	// ErrCancellationAlreadyRequested is the error indicating cancellation for target workflow is already requested
	ErrCancellationAlreadyRequested = &types.CancellationAlreadyRequestedError{Message: "cancellation already requested for this workflow execution"}
	// ErrSignalsLimitExceeded is the error indicating limit reached for maximum number of signal events
	ErrSignalsLimitExceeded = &types.LimitExceededError{Message: "exceeded workflow execution limit for signal events"}
	// ErrQueryEnteredInvalidState is error indicating query entered invalid state
	ErrQueryEnteredInvalidState = &types.BadRequestError{Message: "query entered invalid state, this should be impossible"}
	// ErrQueryWorkflowBeforeFirstDecision is error indicating that query was attempted before first decision task completed
	ErrQueryWorkflowBeforeFirstDecision = &types.QueryFailedError{Message: "workflow must handle at least one decision task before it can be queried"}
	// ErrConsistentQueryNotEnabled is error indicating that consistent query was requested but either cluster or domain does not enable consistent query
	ErrConsistentQueryNotEnabled = &types.BadRequestError{Message: "cluster or domain does not enable strongly consistent query but strongly consistent query was requested"}
	// ErrConsistentQueryBufferExceeded is error indicating that too many consistent queries have been buffered and until buffered queries are finished new consistent queries cannot be buffered
	ErrConsistentQueryBufferExceeded = &types.InternalServiceError{Message: "consistent query buffer is full, cannot accept new consistent queries"}
	// ErrConcurrentStartRequest is error indicating there is an outstanding start workflow request. The incoming request fails to acquires the lock before the outstanding request finishes.
	ErrConcurrentStartRequest = &types.ServiceBusyError{Message: "an outstanding start workflow request is in-progress. Failed to acquire the resource."}
)
View Source
var (
	UpdateWithNewDecision = &UpdateAction{
		CreateDecision: true,
	}
	UpdateWithoutDecision = &UpdateAction{
		CreateDecision: false,
	}
)
View Source
var ConditionalRetryCount = 5

Functions

func UpdateCurrentWithActionFunc

func UpdateCurrentWithActionFunc(
	ctx context.Context,
	cache *execution.Cache,
	executionManager persistence.ExecutionManager,
	domainID string,
	domainCache cache.DomainCache,
	execution types.WorkflowExecution,
	now time.Time,
	action UpdateActionFunc,
) (retError error)

UpdateCurrentWithActionFunc updates the given workflow execution or current execution if runID is empty. It's the same as UpdateWithActionFunc if runID is not empty. This function is suitable for the case when the change should always be applied to the current execution.

func UpdateWithAction

func UpdateWithAction(
	ctx context.Context,
	cache *execution.Cache,
	domainID string,
	execution types.WorkflowExecution,
	createDecisionTask bool,
	now time.Time,
	action func(wfContext execution.Context, mutableState execution.MutableState) error,
) error

TODO: deprecate and use UpdateWithActionFunc

func UpdateWithActionFunc

func UpdateWithActionFunc(
	ctx context.Context,
	cache *execution.Cache,
	domainID string,
	execution types.WorkflowExecution,
	now time.Time,
	action UpdateActionFunc,
) (retError error)

UpdateWithActionFunc updates the given workflow execution. If runID is empty, it only tries to load the current workflow once. If the update should always be applied to the current run, use UpdateCurrentWithActionFunc instead.

Types

type Context

type Context interface {
	GetContext() execution.Context
	GetMutableState() execution.MutableState
	ReloadMutableState(ctx context.Context) (execution.MutableState, error)
	GetReleaseFn() execution.ReleaseFunc
	GetWorkflowID() string
	GetRunID() string
}

Context is an helper interface on top of execution.Context

func Load

func Load(
	ctx context.Context,
	cache *execution.Cache,
	executionManager persistence.ExecutionManager,
	domainID string,
	domainName string,
	workflowID string,
	runID string,
) (Context, error)

func LoadOnce

func LoadOnce(
	ctx context.Context,
	cache *execution.Cache,
	domainID string,
	workflowID string,
	runID string,
) (Context, error)

func NewContext

func NewContext(
	context execution.Context,
	releaseFn execution.ReleaseFunc,
	mutableState execution.MutableState,
) Context

NewContext creates a new helper instance on top of execution.Context

type UpdateAction

type UpdateAction struct {
	Noop           bool
	CreateDecision bool
}

Jump to

Keyboard shortcuts

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