api

package
v1.23.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UpdateWorkflowWithNewWorkflowTask = &UpdateWorkflowAction{
		CreateWorkflowTask: true,
	}
	UpdateWorkflowWithoutWorkflowTask = &UpdateWorkflowAction{
		CreateWorkflowTask: false,
	}
)

Functions

func BypassMutableStateConsistencyPredicate

func BypassMutableStateConsistencyPredicate(
	mutableState workflow.MutableState,
) bool

func CreateMutableState

func CreateMutableState(
	ctx context.Context,
	shard shard.Context,
	namespaceEntry *namespace.Namespace,
	executionTimeout *durationpb.Duration,
	runTimeout *durationpb.Duration,
	runID string,
) (workflow.MutableState, error)

func DeserializeHistoryToken added in v1.23.0

func DeserializeHistoryToken(bytes []byte) (*tokenspb.HistoryContinuation, error)

NOTE: DO NOT MODIFY UNLESS ALSO APPLIED TO ./service/frontend/token_deprecated.go

func DeserializeRawHistoryToken added in v1.23.0

func DeserializeRawHistoryToken(bytes []byte) (*tokenspb.RawHistoryContinuation, error)

NOTE: DO NOT MODIFY UNLESS ALSO APPLIED TO ./service/frontend/token_deprecated.go

func FailMutableStateConsistencyPredicate

func FailMutableStateConsistencyPredicate(
	mutableState workflow.MutableState,
) bool

func GenerateFirstWorkflowTask

func GenerateFirstWorkflowTask(
	mutableState workflow.MutableState,
	parentInfo *workflowspb.ParentExecutionInfo,
	startEvent *historypb.HistoryEvent,
	bypassTaskGeneration bool,
) (int64, error)

func GeneratePaginationToken added in v1.23.0

func GeneratePaginationToken(
	request *historyservice.GetWorkflowExecutionRawHistoryV2Request,
	versionHistories *historyspb.VersionHistories,
) *tokenspb.RawHistoryContinuation

NOTE: DO NOT MODIFY UNLESS ALSO APPLIED TO ./service/frontend/token_deprecated.go

func GetActiveNamespace added in v1.18.0

func GetActiveNamespace(
	shard shard.Context,
	namespaceUUID namespace.ID,
) (*namespace.Namespace, error)

func GetActivityScheduledEventID added in v1.18.0

func GetActivityScheduledEventID(
	activityID string,
	mutableState workflow.MutableState,
) (int64, error)

func GetAndUpdateWorkflowWithNew added in v1.18.0

func GetAndUpdateWorkflowWithNew(
	ctx context.Context,
	reqClock *clockspb.VectorClock,
	consistencyCheckFn MutableStateConsistencyPredicate,
	workflowKey definition.WorkflowKey,
	action UpdateWorkflowActionFunc,
	newWorkflowFn func() (workflow.Context, workflow.MutableState, error),
	shard shard.Context,
	workflowConsistencyChecker WorkflowConsistencyChecker,
) (retError error)

func GetHistory added in v1.23.0

func GetHistory(
	ctx context.Context,
	shard shard.Context,
	namespaceID namespace.ID,
	execution *commonpb.WorkflowExecution,
	firstEventID int64,
	nextEventID int64,
	pageSize int32,
	nextPageToken []byte,
	transientWorkflowTaskInfo *historyspb.TransientWorkflowTaskInfo,
	branchToken []byte,
	persistenceVisibilityMgr manager.VisibilityManager,
) (*historypb.History, []byte, error)

func GetHistoryReverse added in v1.23.0

func GetHistoryReverse(
	ctx context.Context,
	shard shard.Context,
	namespaceID namespace.ID,
	execution *commonpb.WorkflowExecution,
	nextEventID int64,
	lastFirstTxnID int64,
	pageSize int32,
	nextPageToken []byte,
	branchToken []byte,
	persistenceVisibilityMgr manager.VisibilityManager,
) (*historypb.History, []byte, int64, error)

func GetMutableState added in v1.19.0

func GetMutableState(
	ctx context.Context,
	shardContext shard.Context,
	workflowKey definition.WorkflowKey,
	workflowConsistencyChecker WorkflowConsistencyChecker,
) (_ *historyservice.GetMutableStateResponse, retError error)

func GetOrPollMutableState added in v1.19.0

func GetOrPollMutableState(
	ctx context.Context,
	shardContext shard.Context,
	request *historyservice.GetMutableStateRequest,
	workflowConsistencyChecker WorkflowConsistencyChecker,
	eventNotifier events.Notifier,
) (*historyservice.GetMutableStateResponse, error)

func GetRawHistory added in v1.23.0

func GetRawHistory(
	ctx context.Context,
	shard shard.Context,
	namespaceID namespace.ID,
	execution *commonpb.WorkflowExecution,
	firstEventID int64,
	nextEventID int64,
	pageSize int32,
	nextPageToken []byte,
	transientWorkflowTaskInfo *historyspb.TransientWorkflowTaskInfo,
	branchToken []byte,
) ([]*commonpb.DataBlob, []byte, error)

func GetTaskCategory added in v1.23.0

func GetTaskCategory(categoryID int, registry tasks.TaskCategoryRegistry) (tasks.Category, error)

func IsHistoryEventOnCurrentBranch added in v1.19.0

func IsHistoryEventOnCurrentBranch(
	mutableState workflow.MutableState,
	eventID int64,
	eventVersion int64,
) (bool, error)

func IsRetryableError added in v1.17.3

func IsRetryableError(err error) bool

func MutableStateToGetResponse added in v1.19.0

func MutableStateToGetResponse(
	mutableState workflow.MutableState,
) (*historyservice.GetMutableStateResponse, error)

func NewWorkflowVersionCheck

func NewWorkflowVersionCheck(
	shard shard.Context,
	prevLastWriteVersion int64,
	newMutableState workflow.MutableState,
) error

func OverrideStartWorkflowExecutionRequest added in v1.18.0

func OverrideStartWorkflowExecutionRequest(
	request *workflowservice.StartWorkflowExecutionRequest,
	operation string,
	shard shard.Context,
	metricsHandler metrics.Handler,
)

func ProcessOutgoingSearchAttributes added in v1.23.0

func ProcessOutgoingSearchAttributes(
	shard shard.Context,
	events []*historypb.HistoryEvent,
	namespaceId namespace.ID,
	persistenceVisibilityMgr manager.VisibilityManager,
) error

func SerializeHistoryToken added in v1.23.0

func SerializeHistoryToken(token *tokenspb.HistoryContinuation) ([]byte, error)

NOTE: DO NOT MODIFY UNLESS ALSO APPLIED TO ./service/frontend/token_deprecated.go

func SerializeRawHistoryToken added in v1.23.0

func SerializeRawHistoryToken(token *tokenspb.RawHistoryContinuation) ([]byte, error)

NOTE: DO NOT MODIFY UNLESS ALSO APPLIED TO ./service/frontend/token_deprecated.go

func SetActivityTaskRunID added in v1.18.0

func SetActivityTaskRunID(
	ctx context.Context,
	token *tokenspb.Task,
	workflowConsistencyChecker WorkflowConsistencyChecker,
) error

func TrimHistoryNode added in v1.23.0

func TrimHistoryNode(
	ctx context.Context,
	shardContext shard.Context,
	workflowConsistencyChecker WorkflowConsistencyChecker,
	eventNotifier events.Notifier,
	namespaceID string,
	workflowID string,
	runID string,
)

func UpdateWorkflowWithNew

func UpdateWorkflowWithNew(
	shardContext shard.Context,
	ctx context.Context,
	workflowContext WorkflowContext,
	action UpdateWorkflowActionFunc,
	newWorkflowFn func() (workflow.Context, workflow.MutableState, error),
) (retError error)

func ValidateNamespaceUUID added in v1.18.0

func ValidateNamespaceUUID(
	namespaceUUID namespace.ID,
) error

func ValidatePaginationToken added in v1.23.0

func ValidatePaginationToken(
	request *historyservice.GetWorkflowExecutionRawHistoryV2Request,
	token *tokenspb.RawHistoryContinuation,
) error

NOTE: DO NOT MODIFY UNLESS ALSO APPLIED TO ./service/frontend/token_deprecated.go

func ValidateReplicationConfig added in v1.19.0

func ValidateReplicationConfig(
	clusterMetadata cluster.Metadata,
) error

func ValidateSignal

func ValidateSignal(
	ctx context.Context,
	shard shard.Context,
	mutableState workflow.MutableState,
	signalPayloadSize int,
	operation string,
) error

func ValidateStart

func ValidateStart(
	ctx context.Context,
	shard shard.Context,
	namespaceEntry *namespace.Namespace,
	workflowID string,
	workflowInputSize int,
	workflowMemoSize int,
	operation string,
) error

func ValidateStartWorkflowExecutionRequest added in v1.18.0

func ValidateStartWorkflowExecutionRequest(
	ctx context.Context,
	request *workflowservice.StartWorkflowExecutionRequest,
	shard shard.Context,
	namespaceEntry *namespace.Namespace,
	operation string,
) error

Types

type CreateWorkflowCASPredicate

type CreateWorkflowCASPredicate struct {
	RunID            string
	LastWriteVersion int64
}

type MutableStateConsistencyPredicate

type MutableStateConsistencyPredicate func(mutableState workflow.MutableState) bool

func HistoryEventConsistencyPredicate

func HistoryEventConsistencyPredicate(
	eventID int64,
	eventVersion int64,
) MutableStateConsistencyPredicate

type UpdateWorkflowAction

type UpdateWorkflowAction struct {
	Noop               bool
	CreateWorkflowTask bool
}

type UpdateWorkflowActionFunc

type UpdateWorkflowActionFunc func(WorkflowContext) (*UpdateWorkflowAction, error)

func ApplyWorkflowIDReusePolicy

func ApplyWorkflowIDReusePolicy(
	prevStartRequestID,
	prevRunID string,
	prevState enumsspb.WorkflowExecutionState,
	prevStatus enumspb.WorkflowExecutionStatus,
	workflowID string,
	runID string,
	wfIDReusePolicy enumspb.WorkflowIdReusePolicy,
) (UpdateWorkflowActionFunc, error)

ApplyWorkflowIDReusePolicy returns updateWorkflowActionFunc for updating the previous execution and an error if the situation is not allowed by the workflowIDReusePolicy. Both result may be nil, if the case is to allow and no update is needed for the previous execution.

type WorkflowConsistencyChecker

type WorkflowConsistencyChecker interface {
	GetWorkflowCache() wcache.Cache
	GetCurrentRunID(
		ctx context.Context,
		namespaceID string,
		workflowID string,
		lockPriority workflow.LockPriority,
	) (string, error)
	GetWorkflowContext(
		ctx context.Context,
		reqClock *clockspb.VectorClock,
		consistencyPredicate MutableStateConsistencyPredicate,
		workflowKey definition.WorkflowKey,
		lockPriority workflow.LockPriority,
	) (WorkflowContext, error)
}

type WorkflowConsistencyCheckerImpl

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

func NewWorkflowConsistencyChecker

func NewWorkflowConsistencyChecker(
	shardContext shard.Context,
	workflowCache wcache.Cache,
) *WorkflowConsistencyCheckerImpl

func (*WorkflowConsistencyCheckerImpl) GetCurrentRunID

func (c *WorkflowConsistencyCheckerImpl) GetCurrentRunID(
	ctx context.Context,
	namespaceID string,
	workflowID string,
	lockPriority workflow.LockPriority,
) (string, error)

func (*WorkflowConsistencyCheckerImpl) GetWorkflowCache added in v1.19.0

func (c *WorkflowConsistencyCheckerImpl) GetWorkflowCache() wcache.Cache

func (*WorkflowConsistencyCheckerImpl) GetWorkflowContext

func (c *WorkflowConsistencyCheckerImpl) GetWorkflowContext(
	ctx context.Context,
	reqClock *clockspb.VectorClock,
	consistencyPredicate MutableStateConsistencyPredicate,
	workflowKey definition.WorkflowKey,
	lockPriority workflow.LockPriority,
) (WorkflowContext, error)

type WorkflowContext

type WorkflowContext interface {
	GetContext() workflow.Context
	GetMutableState() workflow.MutableState
	GetReleaseFn() wcache.ReleaseCacheFunc

	GetNamespaceEntry() *namespace.Namespace
	GetWorkflowKey() definition.WorkflowKey
	GetUpdateRegistry(context.Context) update.Registry
}

func NewWorkflowWithSignal

func NewWorkflowWithSignal(
	ctx context.Context,
	shard shard.Context,
	namespaceEntry *namespace.Namespace,
	workflowID string,
	runID string,
	startRequest *historyservice.StartWorkflowExecutionRequest,
	signalWithStartRequest *workflowservice.SignalWithStartWorkflowExecutionRequest,
) (WorkflowContext, error)

type WorkflowContextImpl

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

func NewWorkflowContext

func NewWorkflowContext(
	context workflow.Context,
	releaseFn wcache.ReleaseCacheFunc,
	mutableState workflow.MutableState,
) *WorkflowContextImpl

func (*WorkflowContextImpl) GetContext

func (w *WorkflowContextImpl) GetContext() workflow.Context

func (*WorkflowContextImpl) GetMutableState

func (w *WorkflowContextImpl) GetMutableState() workflow.MutableState

func (*WorkflowContextImpl) GetNamespaceEntry

func (w *WorkflowContextImpl) GetNamespaceEntry() *namespace.Namespace

func (*WorkflowContextImpl) GetReleaseFn

func (w *WorkflowContextImpl) GetReleaseFn() wcache.ReleaseCacheFunc

func (*WorkflowContextImpl) GetUpdateRegistry added in v1.21.0

func (w *WorkflowContextImpl) GetUpdateRegistry(ctx context.Context) update.Registry

func (*WorkflowContextImpl) GetWorkflowKey

func (w *WorkflowContextImpl) GetWorkflowKey() definition.WorkflowKey

Jump to

Keyboard shortcuts

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