persistence

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: MIT Imports: 17 Imported by: 35

Documentation

Index

Constants

View Source
const (
	// this is a temp version indicating where is the domain resides
	// either V1 or V2
	DomainTableVersionV1 = 1
	DomainTableVersionV2 = 2

	// 0/1 or empty are all considered as V1
	EventStoreVersionV2 = 2
)

TODO remove this table version

View Source
const (
	DomainStatusRegistered = iota
	DomainStatusDeprecated
	DomainStatusDeleted
)

Domain status

View Source
const (
	// Fail if current record exists
	// Only applicable for CreateWorkflowExecution
	CreateWorkflowModeBrandNew = iota
	// Update current record only if workflow is closed
	// Only applicable for CreateWorkflowExecution
	CreateWorkflowModeWorkflowIDReuse
	// Update current record only if workflow is open
	// Only applicable for UpdateWorkflowExecution
	CreateWorkflowModeContinueAsNew
)

Create Workflow Execution Mode

View Source
const (
	WorkflowStateCreated = iota
	WorkflowStateRunning
	WorkflowStateCompleted
)

Workflow execution states

View Source
const (
	WorkflowCloseStatusNone = iota
	WorkflowCloseStatusCompleted
	WorkflowCloseStatusFailed
	WorkflowCloseStatusCanceled
	WorkflowCloseStatusTerminated
	WorkflowCloseStatusContinuedAsNew
	WorkflowCloseStatusTimedOut
)

Workflow execution close status

View Source
const (
	TaskListTypeDecision = iota
	TaskListTypeActivity
)

Types of task lists

View Source
const (
	TaskListKindNormal = iota
	TaskListKindSticky
)

Kinds of task lists

View Source
const (
	TransferTaskTypeDecisionTask = iota
	TransferTaskTypeActivityTask
	TransferTaskTypeCloseExecution
	TransferTaskTypeCancelExecution
	TransferTaskTypeStartChildExecution
	TransferTaskTypeSignalExecution
	TransferTaskTypeRecordWorkflowStarted
	TransferTaskTypeResetWorkflow
	TransferTaskTypeUpsertWorkflowSearchAttributes
)

Transfer task types

View Source
const (
	ReplicationTaskTypeHistory = iota
	ReplicationTaskTypeSyncActivity
)

Types of replication tasks

View Source
const (
	TaskTypeDecisionTimeout = iota
	TaskTypeActivityTimeout
	TaskTypeUserTimer
	TaskTypeWorkflowTimeout
	TaskTypeDeleteHistoryEvent
	TaskTypeActivityRetryTimer
	TaskTypeWorkflowBackoffTimer
)

Types of timers

View Source
const (
	WorkflowBackoffTimeoutTypeRetry = iota
	WorkflowBackoffTimeoutTypeCron
)

Types of workflow backoff timeout

View Source
const (
	// InitialFailoverNotificationVersion is the initial failover version for a domain
	InitialFailoverNotificationVersion int64 = 0

	// TransferTaskTransferTargetWorkflowID is the the dummy workflow ID for transfer tasks of types
	// that do not have a target workflow
	TransferTaskTransferTargetWorkflowID = "20000000-0000-f000-f000-000000000001"
	// TransferTaskTransferTargetRunID is the the dummy run ID for transfer tasks of types
	// that do not have a target workflow
	TransferTaskTransferTargetRunID = "30000000-0000-f000-f000-000000000002"
)
View Source
const UnknownNumRowsAffected = -1

UnknownNumRowsAffected is returned when the number of rows that an API affected cannot be determined

View Source
const VisibilityEncoding = common.EncodingTypeThriftRW

VisibilityEncoding is default encoding for visibility data

Variables

View Source
var (
	// ErrPersistenceLimitExceeded is the error indicating QPS limit reached.
	ErrPersistenceLimitExceeded = &workflow.ServiceBusyError{Message: "Persistence Max QPS Reached."}
	// ErrPersistenceLimitExceededForList is the error indicating QPS limit reached for list visibility.
	ErrPersistenceLimitExceededForList = &workflow.ServiceBusyError{Message: "Persistence Max QPS Reached for List Operations."}
)

Functions

func DBTimestampToUnixNano added in v0.4.0

func DBTimestampToUnixNano(milliseconds int64) int64

DBTimestampToUnixNano converts CQL timestamp to UnixNano

func DeleteWorkflowExecutionHistoryV2 added in v0.5.2

func DeleteWorkflowExecutionHistoryV2(historyV2Mgr HistoryV2Manager, branchToken []byte, shardID *int, logger log.Logger) error

DeleteWorkflowExecutionHistoryV2 is used to delete workflow execution history from historyV2. Histories in historyV2 are represented as a tree rather than a linear list of history events. The tree based history structure introduces complexities for deletions. The following concepts must be understood in order to understand how histories get deleted: - Branch token is used to identify a single path from root to leaf on the history tree - Creation of child branches from parent branches are not atomic, their creation can be in progress during this method - When a child branch has been forked from the parent branch it will call CompleteForkBranch - Due to failure cases it is possible the child branch started to fork but never called CompleteForkBranch - When deleting a branch, only the section of the branch which is not relied upon by other branches can be safely deleted

Given the above understanding this method can now be explained as the following protocol 1. Attempt to delete branch identified by branch token. The persistence APIs which get invoked are smart enough to only delete the section of branch identified by branch token which are not depended on by other branches. 2. If the delete was successful then return nil. 3. If delete failed then check if it failed due to a child branch fork creation being in progress (error type for child branch fork in progress is ConditionFailedError). 4. If error was not caused by child branch fork in progress then return error. 5. Otherwise history will attempt to be deleted while a child branch fork is ongoing. In order to do this it is checked if the child branch fork was created less than one minute ago. If it was created less than one minute ago return retryable error type indicating that branch cannot be deleted currently but client can retry deletion. If child branch fork has been in progress for longer than one minute then it is assumed the child branch fork will be successful and only the section of history which is not common to the child being created will get deleted.

This protocol is safe in that it will never delete history which is relied upon. But it is not complete in the sense that zombie history segments can remain under some rare failure cases. Consider the following sequence of events 1. Child branch fork started and is in progress. 2. Forking has been in progress for longer than one minute, therefore forking is assumed to be successful. 3. History section of parent branch is deleted. But section of parent which is common to child is not deleted. 4. Our assumption of child branch fork being successful is actually wrong and the child never successfully forked. Under this rare case the section of parent history which was assumed to be common to child will be a zombie history section.

func FromDataBlob added in v0.4.0

func FromDataBlob(blob *DataBlob) ([]byte, string)

FromDataBlob decodes a datablob into a (payload, encodingType) tuple

func GetBeginNodeID added in v0.5.7

func GetBeginNodeID(bi shared.HistoryBranch) int64

GetBeginNodeID gets node id from last ancestor

func GetOrUseDefaultActiveCluster added in v0.3.7

func GetOrUseDefaultActiveCluster(currentClusterName string, activeClusterName string) string

GetOrUseDefaultActiveCluster return the current cluster name or use the input if valid

func IsTimeoutError added in v0.5.7

func IsTimeoutError(err error) bool

IsTimeoutError check whether error is TimeoutError

func NewHistoryBranchToken added in v0.5.0

func NewHistoryBranchToken(treeID string) ([]byte, error)

NewHistoryBranchToken return a new branch token

func NewHistoryBranchTokenFromAnother added in v0.5.2

func NewHistoryBranchTokenFromAnother(branchID string, anotherToken []byte) ([]byte, error)

NewHistoryBranchTokenFromAnother make up a branchToken

func NewOperationNotSupportErrorForVis added in v0.5.7

func NewOperationNotSupportErrorForVis() error

NewOperationNotSupportErrorForVis create error for operation not support in visibility

func NewUnknownEncodingTypeError

func NewUnknownEncodingTypeError(encodingType common.EncodingType) error

NewUnknownEncodingTypeError returns a new instance of encoding type error

func ReadFullPageV2Events added in v0.5.3

func ReadFullPageV2Events(historyV2Mgr HistoryV2Manager, req *ReadHistoryBranchRequest) ([]*shared.HistoryEvent, int, []byte, error)

ReadFullPageV2Events reads a full page of history events from HistoryV2Manager. Due to storage format of V2 History it is not guaranteed that pageSize amount of data is returned. Function returns the list of history events, the size of data read, the next page token, and an error if present.

func ReadFullPageV2EventsByBatch added in v0.6.0

func ReadFullPageV2EventsByBatch(historyV2Mgr HistoryV2Manager, req *ReadHistoryBranchRequest) ([]*shared.History, int, []byte, error)

ReadFullPageV2EventsByBatch reads a full page of history events by batch from HistoryV2Manager. Due to storage format of V2 History it is not guaranteed that pageSize amount of data is returned. Function returns the list of history batches, the size of data read, the next page token, and an error if present.

func SerializeClusterConfigs added in v0.4.0

func SerializeClusterConfigs(replicationConfigs []*ClusterReplicationConfig) []map[string]interface{}

SerializeClusterConfigs makes an array of *ClusterReplicationConfig serializable by flattening them into map[string]interface{}

func ToThriftWorkflowExecutionCloseStatus added in v0.9.0

func ToThriftWorkflowExecutionCloseStatus(
	closeStatus int,
) workflow.WorkflowExecutionCloseStatus

ToThriftWorkflowExecutionCloseStatus convert persistence representation of close status to thrift representation

func UnixNanoToDBTimestamp added in v0.4.0

func UnixNanoToDBTimestamp(timestamp int64) int64

UnixNanoToDBTimestamp converts UnixNano to CQL timestamp

func ValidateCreateWorkflowStateCloseStatus added in v0.5.9

func ValidateCreateWorkflowStateCloseStatus(state int, closeStatus int) error

ValidateCreateWorkflowStateCloseStatus validate workflow state and close status

func ValidateUpdateWorkflowStateCloseStatus added in v0.5.9

func ValidateUpdateWorkflowStateCloseStatus(state int, closeStatus int) error

ValidateUpdateWorkflowStateCloseStatus validate workflow state and close status

Types

type ActivityInfo

type ActivityInfo struct {
	Version                  int64
	ScheduleID               int64
	ScheduledEventBatchID    int64
	ScheduledEvent           *workflow.HistoryEvent
	ScheduledTime            time.Time
	StartedID                int64
	StartedEvent             *workflow.HistoryEvent
	StartedTime              time.Time
	ActivityID               string
	RequestID                string
	Details                  []byte
	ScheduleToStartTimeout   int32
	ScheduleToCloseTimeout   int32
	StartToCloseTimeout      int32
	HeartbeatTimeout         int32
	CancelRequested          bool
	CancelRequestID          int64
	LastHeartBeatUpdatedTime time.Time
	TimerTaskStatus          int32
	// For retry
	Attempt            int32
	DomainID           string
	StartedIdentity    string
	TaskList           string
	HasRetryPolicy     bool
	InitialInterval    int32
	BackoffCoefficient float64
	MaximumInterval    int32
	ExpirationTime     time.Time
	MaximumAttempts    int32
	NonRetriableErrors []string
	LastFailureReason  string
	LastWorkerIdentity string
	LastFailureDetails []byte
	// Not written to database - This is used only for deduping heartbeat timer creation
	LastHeartbeatTimeoutVisibility int64
}

ActivityInfo details.

type ActivityRetryTimerTask added in v0.4.0

type ActivityRetryTimerTask struct {
	VisibilityTimestamp time.Time
	TaskID              int64
	EventID             int64
	Version             int64
	Attempt             int32
}

ActivityRetryTimerTask to schedule a retry task for activity

func (*ActivityRetryTimerTask) GetTaskID added in v0.4.0

func (r *ActivityRetryTimerTask) GetTaskID() int64

GetTaskID returns the sequence ID.

func (*ActivityRetryTimerTask) GetType added in v0.4.0

func (r *ActivityRetryTimerTask) GetType() int

GetType returns the type of the retry timer task

func (*ActivityRetryTimerTask) GetVersion added in v0.4.0

func (r *ActivityRetryTimerTask) GetVersion() int64

GetVersion returns the version of the retry timer task

func (*ActivityRetryTimerTask) GetVisibilityTimestamp added in v0.4.0

func (r *ActivityRetryTimerTask) GetVisibilityTimestamp() time.Time

GetVisibilityTimestamp gets the visibility time stamp

func (*ActivityRetryTimerTask) SetTaskID added in v0.4.0

func (r *ActivityRetryTimerTask) SetTaskID(id int64)

SetTaskID sets the sequence ID.

func (*ActivityRetryTimerTask) SetVersion added in v0.4.0

func (r *ActivityRetryTimerTask) SetVersion(version int64)

SetVersion returns the version of the retry timer task

func (*ActivityRetryTimerTask) SetVisibilityTimestamp added in v0.4.0

func (r *ActivityRetryTimerTask) SetVisibilityTimestamp(t time.Time)

SetVisibilityTimestamp gets the visibility time stamp

type ActivityTask

type ActivityTask struct {
	VisibilityTimestamp time.Time
	TaskID              int64
	DomainID            string
	TaskList            string
	ScheduleID          int64
	Version             int64
}

ActivityTask identifies a transfer task for activity

func (*ActivityTask) GetTaskID

func (a *ActivityTask) GetTaskID() int64

GetTaskID returns the sequence ID of the activity task

func (*ActivityTask) GetType

func (a *ActivityTask) GetType() int

GetType returns the type of the activity task

func (*ActivityTask) GetVersion added in v0.3.12

func (a *ActivityTask) GetVersion() int64

GetVersion returns the version of the activity task

func (*ActivityTask) GetVisibilityTimestamp added in v0.3.14

func (a *ActivityTask) GetVisibilityTimestamp() time.Time

GetVisibilityTimestamp get the visibility timestamp

func (*ActivityTask) SetTaskID

func (a *ActivityTask) SetTaskID(id int64)

SetTaskID sets the sequence ID of the activity task

func (*ActivityTask) SetVersion added in v0.3.12

func (a *ActivityTask) SetVersion(version int64)

SetVersion returns the version of the activity task

func (*ActivityTask) SetVisibilityTimestamp added in v0.3.14

func (a *ActivityTask) SetVisibilityTimestamp(timestamp time.Time)

SetVisibilityTimestamp set the visibility timestamp

type ActivityTimeoutTask

type ActivityTimeoutTask struct {
	VisibilityTimestamp time.Time
	TaskID              int64
	TimeoutType         int
	EventID             int64
	Attempt             int64
	Version             int64
}

ActivityTimeoutTask identifies a timeout task.

func (*ActivityTimeoutTask) GetTaskID

func (a *ActivityTimeoutTask) GetTaskID() int64

GetTaskID returns the sequence ID.

func (*ActivityTimeoutTask) GetType

func (a *ActivityTimeoutTask) GetType() int

GetType returns the type of the timer task

func (*ActivityTimeoutTask) GetVersion added in v0.3.12

func (a *ActivityTimeoutTask) GetVersion() int64

GetVersion returns the version of the timer task

func (*ActivityTimeoutTask) GetVisibilityTimestamp

func (a *ActivityTimeoutTask) GetVisibilityTimestamp() time.Time

GetVisibilityTimestamp gets the visibility time stamp

func (*ActivityTimeoutTask) SetTaskID

func (a *ActivityTimeoutTask) SetTaskID(id int64)

SetTaskID sets the sequence ID.

func (*ActivityTimeoutTask) SetVersion added in v0.3.12

func (a *ActivityTimeoutTask) SetVersion(version int64)

SetVersion returns the version of the timer task

func (*ActivityTimeoutTask) SetVisibilityTimestamp

func (a *ActivityTimeoutTask) SetVisibilityTimestamp(t time.Time)

SetVisibilityTimestamp gets the visibility time stamp

type AppendHistoryEventsRequest

type AppendHistoryEventsRequest struct {
	DomainID          string
	Execution         workflow.WorkflowExecution
	FirstEventID      int64
	EventBatchVersion int64
	RangeID           int64
	TransactionID     int64
	Events            []*workflow.HistoryEvent
	Overwrite         bool
	Encoding          common.EncodingType // optional binary encoding type
}

AppendHistoryEventsRequest is used to append new events to workflow execution history Deprecated: use v2 API-AppendHistoryNodes() instead

type AppendHistoryEventsResponse added in v0.4.0

type AppendHistoryEventsResponse struct {
	Size int
}

AppendHistoryEventsResponse is response for AppendHistoryEventsRequest Deprecated: uses V2 API-AppendHistoryNodesRequest

type AppendHistoryNodesRequest added in v0.5.0

type AppendHistoryNodesRequest struct {
	// true if this is the first append request to the branch
	IsNewBranch bool
	// the info for clean up data in background
	Info string
	// The branch to be appended
	BranchToken []byte
	// The batch of events to be appended. The first eventID will become the nodeID of this batch
	Events []*workflow.HistoryEvent
	// requested TransactionID for this write operation. For the same eventID, the node with larger TransactionID always wins
	TransactionID int64
	// optional binary encoding type
	Encoding common.EncodingType
	// The shard to get history node data
	ShardID *int
}

AppendHistoryNodesRequest is used to append a batch of history nodes

type AppendHistoryNodesResponse added in v0.5.0

type AppendHistoryNodesResponse struct {
	// the size of the event data that has been appended
	Size int
}

AppendHistoryNodesResponse is a response to AppendHistoryNodesRequest

type CadenceDeserializationError added in v0.5.7

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

CadenceDeserializationError is an error type for cadence deserialization

func NewCadenceDeserializationError added in v0.5.7

func NewCadenceDeserializationError(msg string) *CadenceDeserializationError

NewCadenceDeserializationError returns a CadenceDeserializationError

func (*CadenceDeserializationError) Error added in v0.5.7

type CadenceSerializationError added in v0.5.7

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

CadenceSerializationError is an error type for cadence serialization

func NewCadenceSerializationError added in v0.5.7

func NewCadenceSerializationError(msg string) *CadenceSerializationError

NewCadenceSerializationError returns a CadenceSerializationError

func (*CadenceSerializationError) Error added in v0.5.7

func (e *CadenceSerializationError) Error() string

type CancelExecutionTask

type CancelExecutionTask struct {
	VisibilityTimestamp     time.Time
	TaskID                  int64
	TargetDomainID          string
	TargetWorkflowID        string
	TargetRunID             string
	TargetChildWorkflowOnly bool
	InitiatedID             int64
	Version                 int64
}

CancelExecutionTask identifies a transfer task for cancel of execution

func (*CancelExecutionTask) GetTaskID

func (u *CancelExecutionTask) GetTaskID() int64

GetTaskID returns the sequence ID of the cancel transfer task.

func (*CancelExecutionTask) GetType

func (u *CancelExecutionTask) GetType() int

GetType returns the type of the cancel transfer task

func (*CancelExecutionTask) GetVersion added in v0.3.12

func (u *CancelExecutionTask) GetVersion() int64

GetVersion returns the version of the cancel transfer task

func (*CancelExecutionTask) GetVisibilityTimestamp added in v0.3.14

func (u *CancelExecutionTask) GetVisibilityTimestamp() time.Time

GetVisibilityTimestamp get the visibility timestamp

func (*CancelExecutionTask) SetTaskID

func (u *CancelExecutionTask) SetTaskID(id int64)

SetTaskID sets the sequence ID of the cancel transfer task.

func (*CancelExecutionTask) SetVersion added in v0.3.12

func (u *CancelExecutionTask) SetVersion(version int64)

SetVersion returns the version of the cancel transfer task

func (*CancelExecutionTask) SetVisibilityTimestamp added in v0.3.14

func (u *CancelExecutionTask) SetVisibilityTimestamp(timestamp time.Time)

SetVisibilityTimestamp set the visibility timestamp

type ChildExecutionInfo

type ChildExecutionInfo struct {
	Version               int64
	InitiatedID           int64
	InitiatedEventBatchID int64
	InitiatedEvent        *workflow.HistoryEvent
	StartedID             int64
	StartedWorkflowID     string
	StartedRunID          string
	StartedEvent          *workflow.HistoryEvent
	CreateRequestID       string
	DomainName            string
	WorkflowTypeName      string
	ParentClosePolicy     workflow.ParentClosePolicy
}

ChildExecutionInfo has details for pending child executions.

type CloseExecutionTask added in v0.3.3

type CloseExecutionTask struct {
	VisibilityTimestamp time.Time
	TaskID              int64
	Version             int64
}

CloseExecutionTask identifies a transfer task for deletion of execution

func (*CloseExecutionTask) GetTaskID added in v0.3.3

func (a *CloseExecutionTask) GetTaskID() int64

GetTaskID returns the sequence ID of the close execution task

func (*CloseExecutionTask) GetType added in v0.3.3

func (a *CloseExecutionTask) GetType() int

GetType returns the type of the close execution task

func (*CloseExecutionTask) GetVersion added in v0.3.12

func (a *CloseExecutionTask) GetVersion() int64

GetVersion returns the version of the close execution task

func (*CloseExecutionTask) GetVisibilityTimestamp added in v0.3.14

func (a *CloseExecutionTask) GetVisibilityTimestamp() time.Time

GetVisibilityTimestamp get the visibility timestamp

func (*CloseExecutionTask) SetTaskID added in v0.3.3

func (a *CloseExecutionTask) SetTaskID(id int64)

SetTaskID sets the sequence ID of the close execution task

func (*CloseExecutionTask) SetVersion added in v0.3.12

func (a *CloseExecutionTask) SetVersion(version int64)

SetVersion returns the version of the close execution task

func (*CloseExecutionTask) SetVisibilityTimestamp added in v0.3.14

func (a *CloseExecutionTask) SetVisibilityTimestamp(timestamp time.Time)

SetVisibilityTimestamp set the visibility timestamp

type Closeable

type Closeable interface {
	Close()
}

Closeable is an interface for any entity that supports a close operation to release resources

type ClusterReplicationConfig added in v0.3.7

type ClusterReplicationConfig struct {
	ClusterName string
}

ClusterReplicationConfig describes the cross DC cluster replication configuration

func DeserializeClusterConfigs added in v0.4.0

func DeserializeClusterConfigs(replicationConfigs []map[string]interface{}) []*ClusterReplicationConfig

DeserializeClusterConfigs creates an array of ClusterReplicationConfigs from an array of map representations

func GetOrUseDefaultClusters added in v0.3.7

func GetOrUseDefaultClusters(currentClusterName string, clusters []*ClusterReplicationConfig) []*ClusterReplicationConfig

GetOrUseDefaultClusters return the current cluster or use the input if valid

type CompleteForkBranchRequest added in v0.5.2

type CompleteForkBranchRequest struct {
	// the new branch returned from ForkHistoryBranchRequest
	BranchToken []byte
	// true means the fork is success, will update the flag, otherwise will delete the new branch
	Success bool
	// The shard to update history branch data
	ShardID *int
}

CompleteForkBranchRequest is used to complete forking

type CompleteReplicationTaskRequest added in v0.3.11

type CompleteReplicationTaskRequest struct {
	TaskID int64
}

CompleteReplicationTaskRequest is used to complete a task in the replication task queue

type CompleteTaskRequest

type CompleteTaskRequest struct {
	TaskList *TaskListInfo
	TaskID   int64
}

CompleteTaskRequest is used to complete a task

type CompleteTasksLessThanRequest added in v0.5.4

type CompleteTasksLessThanRequest struct {
	DomainID     string
	TaskListName string
	TaskType     int
	TaskID       int64 // Tasks less than or equal to this ID will be completed
	Limit        int   // Limit on the max number of tasks that can be completed. Required param
}

CompleteTasksLessThanRequest contains the request params needed to invoke CompleteTasksLessThan API

type CompleteTimerTaskRequest

type CompleteTimerTaskRequest struct {
	VisibilityTimestamp time.Time
	TaskID              int64
}

CompleteTimerTaskRequest is used to complete a task in the timer task queue

type CompleteTransferTaskRequest

type CompleteTransferTaskRequest struct {
	TaskID int64
}

CompleteTransferTaskRequest is used to complete a task in the transfer task queue

type ConditionFailedError

type ConditionFailedError struct {
	Msg string
}

ConditionFailedError represents a failed conditional update for execution record

func (*ConditionFailedError) Error

func (e *ConditionFailedError) Error() string

type ConflictResolveWorkflowExecutionRequest added in v0.7.0

type ConflictResolveWorkflowExecutionRequest struct {
	RangeID int64

	// previous workflow information
	PrevRunID            string
	PrevLastWriteVersion int64
	PrevState            int

	// workflow to be resetted
	ResetWorkflowSnapshot WorkflowSnapshot

	// current workflow
	CurrentWorkflowMutation *WorkflowMutation

	Encoding common.EncodingType // optional binary encoding type
}

ConflictResolveWorkflowExecutionRequest is used to reset workflow execution state for a single run

type CountWorkflowExecutionsRequest added in v0.5.8

type CountWorkflowExecutionsRequest struct {
	DomainUUID string
	Domain     string // domain name is not persisted, but used as config filter key
	Query      string
}

CountWorkflowExecutionsRequest is request from CountWorkflowExecutions

type CountWorkflowExecutionsResponse added in v0.5.8

type CountWorkflowExecutionsResponse struct {
	Count int64
}

CountWorkflowExecutionsResponse is response to CountWorkflowExecutions

type CreateDomainRequest

type CreateDomainRequest struct {
	Info              *DomainInfo
	Config            *DomainConfig
	ReplicationConfig *DomainReplicationConfig
	IsGlobalDomain    bool
	ConfigVersion     int64
	FailoverVersion   int64
}

CreateDomainRequest is used to create the domain

type CreateDomainResponse

type CreateDomainResponse struct {
	ID string
}

CreateDomainResponse is the response for CreateDomain

type CreateShardRequest

type CreateShardRequest struct {
	ShardInfo *ShardInfo
}

CreateShardRequest is used to create a shard in executions table

type CreateTaskInfo

type CreateTaskInfo struct {
	Execution workflow.WorkflowExecution
	Data      *TaskInfo
	TaskID    int64
}

CreateTaskInfo describes a task to be created in CreateTasksRequest

type CreateTasksRequest

type CreateTasksRequest struct {
	TaskListInfo *TaskListInfo
	Tasks        []*CreateTaskInfo
}

CreateTasksRequest is used to create a new task for a workflow exectution

type CreateTasksResponse

type CreateTasksResponse struct {
}

CreateTasksResponse is the response to CreateTasksRequest

type CreateWorkflowExecutionRequest

type CreateWorkflowExecutionRequest struct {
	RangeID int64

	CreateWorkflowMode int

	PreviousRunID            string
	PreviousLastWriteVersion int64

	NewWorkflowSnapshot WorkflowSnapshot
}

CreateWorkflowExecutionRequest is used to write a new workflow execution

type CreateWorkflowExecutionResponse

type CreateWorkflowExecutionResponse struct {
}

CreateWorkflowExecutionResponse is the response to CreateWorkflowExecutionRequest

type CurrentWorkflowConditionFailedError added in v0.4.0

type CurrentWorkflowConditionFailedError struct {
	Msg string
}

CurrentWorkflowConditionFailedError represents a failed conditional update for current workflow record

func (*CurrentWorkflowConditionFailedError) Error added in v0.4.0

type DataBlob added in v0.4.0

type DataBlob struct {
	Encoding common.EncodingType
	Data     []byte
}

DataBlob represents a blob for any binary data. It contains raw data, and metadata(right now only encoding) in other field Note that it should be only used for Persistence layer, below dataInterface and application(historyEngine/etc)

func NewDataBlob added in v0.4.0

func NewDataBlob(data []byte, encodingType common.EncodingType) *DataBlob

NewDataBlob returns a new DataBlob

func (*DataBlob) GetEncoding added in v0.4.0

func (d *DataBlob) GetEncoding() common.EncodingType

GetEncoding returns encoding type

type DecisionTask

type DecisionTask struct {
	VisibilityTimestamp time.Time
	TaskID              int64
	DomainID            string
	TaskList            string
	ScheduleID          int64
	Version             int64
	RecordVisibility    bool
}

DecisionTask identifies a transfer task for decision

func (*DecisionTask) GetTaskID

func (d *DecisionTask) GetTaskID() int64

GetTaskID returns the sequence ID of the decision task.

func (*DecisionTask) GetType

func (d *DecisionTask) GetType() int

GetType returns the type of the decision task

func (*DecisionTask) GetVersion added in v0.3.12

func (d *DecisionTask) GetVersion() int64

GetVersion returns the version of the decision task

func (*DecisionTask) GetVisibilityTimestamp added in v0.3.14

func (d *DecisionTask) GetVisibilityTimestamp() time.Time

GetVisibilityTimestamp get the visibility timestamp

func (*DecisionTask) SetTaskID

func (d *DecisionTask) SetTaskID(id int64)

SetTaskID sets the sequence ID of the decision task

func (*DecisionTask) SetVersion added in v0.3.12

func (d *DecisionTask) SetVersion(version int64)

SetVersion returns the version of the decision task

func (*DecisionTask) SetVisibilityTimestamp added in v0.3.14

func (d *DecisionTask) SetVisibilityTimestamp(timestamp time.Time)

SetVisibilityTimestamp set the visibility timestamp

type DecisionTimeoutTask

type DecisionTimeoutTask struct {
	VisibilityTimestamp time.Time
	TaskID              int64
	EventID             int64
	ScheduleAttempt     int64
	TimeoutType         int
	Version             int64
}

DecisionTimeoutTask identifies a timeout task.

func (*DecisionTimeoutTask) GetTaskID

func (d *DecisionTimeoutTask) GetTaskID() int64

GetTaskID returns the sequence ID.

func (*DecisionTimeoutTask) GetType

func (d *DecisionTimeoutTask) GetType() int

GetType returns the type of the timer task

func (*DecisionTimeoutTask) GetVersion added in v0.3.12

func (d *DecisionTimeoutTask) GetVersion() int64

GetVersion returns the version of the timer task

func (*DecisionTimeoutTask) GetVisibilityTimestamp

func (d *DecisionTimeoutTask) GetVisibilityTimestamp() time.Time

GetVisibilityTimestamp gets the visibility time stamp

func (*DecisionTimeoutTask) SetTaskID

func (d *DecisionTimeoutTask) SetTaskID(id int64)

SetTaskID sets the sequence ID.

func (*DecisionTimeoutTask) SetVersion added in v0.3.12

func (d *DecisionTimeoutTask) SetVersion(version int64)

SetVersion returns the version of the timer task

func (*DecisionTimeoutTask) SetVisibilityTimestamp

func (d *DecisionTimeoutTask) SetVisibilityTimestamp(t time.Time)

SetVisibilityTimestamp gets the visibility time stamp

type DeleteCurrentWorkflowExecutionRequest added in v0.5.8

type DeleteCurrentWorkflowExecutionRequest struct {
	DomainID   string
	WorkflowID string
	RunID      string
}

DeleteCurrentWorkflowExecutionRequest is used to delete the current workflow execution

type DeleteDomainByNameRequest

type DeleteDomainByNameRequest struct {
	Name string
}

DeleteDomainByNameRequest is used to delete domain entry from domains_by_name table

type DeleteDomainRequest

type DeleteDomainRequest struct {
	ID string
}

DeleteDomainRequest is used to delete domain entry from domains table

type DeleteHistoryBranchRequest added in v0.5.0

type DeleteHistoryBranchRequest struct {
	// branch to be deleted
	BranchToken []byte
	// The shard to delete history branch data
	ShardID *int
}

DeleteHistoryBranchRequest is used to remove a history branch

type DeleteHistoryEventTask

type DeleteHistoryEventTask struct {
	VisibilityTimestamp time.Time
	TaskID              int64
	Version             int64
}

DeleteHistoryEventTask identifies a timer task for deletion of history events of completed execution.

func (*DeleteHistoryEventTask) GetTaskID

func (a *DeleteHistoryEventTask) GetTaskID() int64

GetTaskID returns the sequence ID of the delete execution task

func (*DeleteHistoryEventTask) GetType

func (a *DeleteHistoryEventTask) GetType() int

GetType returns the type of the delete execution task

func (*DeleteHistoryEventTask) GetVersion added in v0.3.12

func (a *DeleteHistoryEventTask) GetVersion() int64

GetVersion returns the version of the delete execution task

func (*DeleteHistoryEventTask) GetVisibilityTimestamp added in v0.3.14

func (a *DeleteHistoryEventTask) GetVisibilityTimestamp() time.Time

GetVisibilityTimestamp get the visibility timestamp

func (*DeleteHistoryEventTask) SetTaskID

func (a *DeleteHistoryEventTask) SetTaskID(id int64)

SetTaskID sets the sequence ID of the delete execution task

func (*DeleteHistoryEventTask) SetVersion added in v0.3.12

func (a *DeleteHistoryEventTask) SetVersion(version int64)

SetVersion returns the version of the delete execution task

func (*DeleteHistoryEventTask) SetVisibilityTimestamp added in v0.3.14

func (a *DeleteHistoryEventTask) SetVisibilityTimestamp(timestamp time.Time)

SetVisibilityTimestamp set the visibility timestamp

type DeleteTaskListRequest added in v0.5.4

type DeleteTaskListRequest struct {
	DomainID     string
	TaskListName string
	TaskListType int
	RangeID      int64
}

DeleteTaskListRequest contains the request params needed to invoke DeleteTaskList API

type DeleteTaskRequest added in v0.9.0

type DeleteTaskRequest struct {
	TaskID  int64
	Type    int
	ShardID int
}

DeleteTaskRequest is used to detele a task that corrupted and need to be removed

e.g. corrupted history event batch, eventID is not continouous

type DeleteWorkflowExecutionHistoryRequest

type DeleteWorkflowExecutionHistoryRequest struct {
	DomainID  string
	Execution workflow.WorkflowExecution
}

DeleteWorkflowExecutionHistoryRequest is used to delete workflow execution history Deprecated: use v2 API-AppendHistoryNodes() instead

type DeleteWorkflowExecutionRequest

type DeleteWorkflowExecutionRequest struct {
	DomainID   string
	WorkflowID string
	RunID      string
}

DeleteWorkflowExecutionRequest is used to delete a workflow execution

type DomainConfig

type DomainConfig struct {
	// NOTE: this retention is in days, not in seconds
	Retention                int32
	EmitMetric               bool
	HistoryArchivalStatus    workflow.ArchivalStatus
	HistoryArchivalURI       string
	VisibilityArchivalStatus workflow.ArchivalStatus
	VisibilityArchivalURI    string
	BadBinaries              workflow.BadBinaries
}

DomainConfig describes the domain configuration

type DomainInfo

type DomainInfo struct {
	ID          string
	Name        string
	Status      int
	Description string
	OwnerEmail  string
	Data        map[string]string
}

DomainInfo describes the domain entity

type DomainReplicationConfig added in v0.3.7

type DomainReplicationConfig struct {
	ActiveClusterName string
	Clusters          []*ClusterReplicationConfig
}

DomainReplicationConfig describes the cross DC domain replication configuration

type ExecutionManager

type ExecutionManager interface {
	Closeable
	GetName() string
	GetShardID() int

	CreateWorkflowExecution(request *CreateWorkflowExecutionRequest) (*CreateWorkflowExecutionResponse, error)
	GetWorkflowExecution(request *GetWorkflowExecutionRequest) (*GetWorkflowExecutionResponse, error)
	UpdateWorkflowExecution(request *UpdateWorkflowExecutionRequest) (*UpdateWorkflowExecutionResponse, error)
	ConflictResolveWorkflowExecution(request *ConflictResolveWorkflowExecutionRequest) error
	ResetWorkflowExecution(request *ResetWorkflowExecutionRequest) error
	DeleteWorkflowExecution(request *DeleteWorkflowExecutionRequest) error
	DeleteCurrentWorkflowExecution(request *DeleteCurrentWorkflowExecutionRequest) error
	GetCurrentExecution(request *GetCurrentExecutionRequest) (*GetCurrentExecutionResponse, error)

	// Transfer task related methods
	GetTransferTasks(request *GetTransferTasksRequest) (*GetTransferTasksResponse, error)
	CompleteTransferTask(request *CompleteTransferTaskRequest) error
	RangeCompleteTransferTask(request *RangeCompleteTransferTaskRequest) error

	// Replication task related methods
	GetReplicationTasks(request *GetReplicationTasksRequest) (*GetReplicationTasksResponse, error)
	CompleteReplicationTask(request *CompleteReplicationTaskRequest) error

	// Timer related methods.
	GetTimerIndexTasks(request *GetTimerIndexTasksRequest) (*GetTimerIndexTasksResponse, error)
	CompleteTimerTask(request *CompleteTimerTaskRequest) error
	RangeCompleteTimerTask(request *RangeCompleteTimerTaskRequest) error

	// Remove Task due to corrupted data
	DeleteTask(request *DeleteTaskRequest) error
}

ExecutionManager is used to manage workflow executions

func NewExecutionManagerImpl added in v0.4.0

func NewExecutionManagerImpl(
	persistence ExecutionStore,
	logger log.Logger,
) ExecutionManager

NewExecutionManagerImpl returns new ExecutionManager

func NewWorkflowExecutionPersistenceMetricsClient added in v0.3.14

func NewWorkflowExecutionPersistenceMetricsClient(persistence ExecutionManager, metricClient metrics.Client, logger log.Logger) ExecutionManager

NewWorkflowExecutionPersistenceMetricsClient creates a client to manage executions

func NewWorkflowExecutionPersistenceRateLimitedClient added in v0.3.14

func NewWorkflowExecutionPersistenceRateLimitedClient(persistence ExecutionManager, rateLimiter quotas.Limiter, logger log.Logger) ExecutionManager

NewWorkflowExecutionPersistenceRateLimitedClient creates a client to manage executions

type ExecutionManagerFactory

type ExecutionManagerFactory interface {
	Closeable
	NewExecutionManager(shardID int) (ExecutionManager, error)
}

ExecutionManagerFactory creates an instance of ExecutionManager for a given shard

type ExecutionStats added in v0.7.0

type ExecutionStats struct {
	HistorySize int64
}

ExecutionStats is the statistics about workflow execution

type ExecutionStore added in v0.4.0

type ExecutionStore interface {
	Closeable
	GetName() string
	GetShardID() int
	//The below three APIs are related to serialization/deserialization
	GetWorkflowExecution(request *GetWorkflowExecutionRequest) (*InternalGetWorkflowExecutionResponse, error)
	UpdateWorkflowExecution(request *InternalUpdateWorkflowExecutionRequest) error
	ConflictResolveWorkflowExecution(request *InternalConflictResolveWorkflowExecutionRequest) error
	ResetWorkflowExecution(request *InternalResetWorkflowExecutionRequest) error

	CreateWorkflowExecution(request *InternalCreateWorkflowExecutionRequest) (*CreateWorkflowExecutionResponse, error)
	DeleteWorkflowExecution(request *DeleteWorkflowExecutionRequest) error
	DeleteCurrentWorkflowExecution(request *DeleteCurrentWorkflowExecutionRequest) error
	GetCurrentExecution(request *GetCurrentExecutionRequest) (*GetCurrentExecutionResponse, error)

	// Transfer task related methods
	GetTransferTasks(request *GetTransferTasksRequest) (*GetTransferTasksResponse, error)
	CompleteTransferTask(request *CompleteTransferTaskRequest) error
	RangeCompleteTransferTask(request *RangeCompleteTransferTaskRequest) error

	// Replication task related methods
	GetReplicationTasks(request *GetReplicationTasksRequest) (*GetReplicationTasksResponse, error)
	CompleteReplicationTask(request *CompleteReplicationTaskRequest) error

	// Timer related methods.
	GetTimerIndexTasks(request *GetTimerIndexTasksRequest) (*GetTimerIndexTasksResponse, error)
	CompleteTimerTask(request *CompleteTimerTaskRequest) error
	RangeCompleteTimerTask(request *RangeCompleteTimerTaskRequest) error

	// Remove corrupted task
	DeleteTask(request *DeleteTaskRequest) error
}

ExecutionStore is used to manage workflow executions for Persistence layer

type ForkHistoryBranchRequest added in v0.5.0

type ForkHistoryBranchRequest struct {
	// The base branch to fork from
	ForkBranchToken []byte
	// The nodeID to fork from, the new branch will start from ( inclusive ), the base branch will stop at(exclusive)
	// Application must provide a void forking nodeID, it must be a valid nodeID in that branch. A valid nodeID is the firstEventID of a valid batch of events.
	// And ForkNodeID > 1 because forking from 1 doesn't make any sense.
	ForkNodeID int64
	// the info for clean up data in background
	Info string
	// The shard to get history branch data
	ShardID *int
}

ForkHistoryBranchRequest is used to fork a history branch

type ForkHistoryBranchResponse added in v0.5.0

type ForkHistoryBranchResponse struct {
	// branchToken to represent the new branch
	NewBranchToken []byte
}

ForkHistoryBranchResponse is the response to ForkHistoryBranchRequest

type GetAllHistoryTreeBranchesRequest added in v0.9.0

type GetAllHistoryTreeBranchesRequest struct {
	// pagination token
	NextPageToken []byte
	// maximum number of branches returned per page
	PageSize int
}

GetAllHistoryTreeBranchesRequest is a request of GetAllHistoryTreeBranches

type GetAllHistoryTreeBranchesResponse added in v0.9.0

type GetAllHistoryTreeBranchesResponse struct {
	// pagination token
	NextPageToken []byte
	// all branches of all trees
	Branches []HistoryBranchDetail
}

GetAllHistoryTreeBranchesResponse is a response to GetAllHistoryTreeBranches

type GetClosedWorkflowExecutionRequest

type GetClosedWorkflowExecutionRequest struct {
	DomainUUID string
	Domain     string // domain name is not persisted, but used as config filter key
	Execution  s.WorkflowExecution
}

GetClosedWorkflowExecutionRequest is used retrieve the record for a specific execution

type GetClosedWorkflowExecutionResponse

type GetClosedWorkflowExecutionResponse struct {
	Execution *s.WorkflowExecutionInfo
}

GetClosedWorkflowExecutionResponse is the response to GetClosedWorkflowExecutionRequest

type GetCurrentExecutionRequest

type GetCurrentExecutionRequest struct {
	DomainID   string
	WorkflowID string
}

GetCurrentExecutionRequest is used to retrieve the current RunId for an execution

type GetCurrentExecutionResponse

type GetCurrentExecutionResponse struct {
	StartRequestID   string
	RunID            string
	State            int
	CloseStatus      int
	LastWriteVersion int64
}

GetCurrentExecutionResponse is the response to GetCurrentExecution

type GetDomainRequest

type GetDomainRequest struct {
	ID   string
	Name string
}

GetDomainRequest is used to read domain

type GetDomainResponse

type GetDomainResponse struct {
	Info                        *DomainInfo
	Config                      *DomainConfig
	ReplicationConfig           *DomainReplicationConfig
	IsGlobalDomain              bool
	ConfigVersion               int64
	FailoverVersion             int64
	FailoverNotificationVersion int64
	NotificationVersion         int64
	TableVersion                int
}

GetDomainResponse is the response for GetDomain

type GetHistoryTreeRequest added in v0.5.0

type GetHistoryTreeRequest struct {
	// A UUID of a tree
	TreeID string
	// Get data from this shard
	ShardID *int
	// optional: can provide treeID via branchToken if treeID is empty
	BranchToken []byte
}

GetHistoryTreeRequest is used to retrieve branch info of a history tree

type GetHistoryTreeResponse added in v0.5.0

type GetHistoryTreeResponse struct {
	// all branches of a tree
	Branches                  []*workflow.HistoryBranch
	ForkingInProgressBranches []HistoryBranchDetail
}

GetHistoryTreeResponse is a response to GetHistoryTreeRequest

type GetMetadataResponse added in v0.3.13

type GetMetadataResponse struct {
	NotificationVersion int64
}

GetMetadataResponse is the response for GetMetadata

type GetReplicationTasksRequest added in v0.3.11

type GetReplicationTasksRequest struct {
	ReadLevel     int64
	MaxReadLevel  int64
	BatchSize     int
	NextPageToken []byte
}

GetReplicationTasksRequest is used to read tasks from the replication task queue

type GetReplicationTasksResponse added in v0.3.11

type GetReplicationTasksResponse struct {
	Tasks         []*ReplicationTaskInfo
	NextPageToken []byte
}

GetReplicationTasksResponse is the response to GetReplicationTask

type GetShardRequest

type GetShardRequest struct {
	ShardID int
}

GetShardRequest is used to get shard information

type GetShardResponse

type GetShardResponse struct {
	ShardInfo *ShardInfo
}

GetShardResponse is the response to GetShard

type GetTasksRequest

type GetTasksRequest struct {
	DomainID     string
	TaskList     string
	TaskType     int
	ReadLevel    int64  // range exclusive
	MaxReadLevel *int64 // optional: range inclusive when specified
	BatchSize    int
}

GetTasksRequest is used to retrieve tasks of a task list

type GetTasksResponse

type GetTasksResponse struct {
	Tasks []*TaskInfo
}

GetTasksResponse is the response to GetTasksRequests

type GetTimerIndexTasksRequest

type GetTimerIndexTasksRequest struct {
	MinTimestamp  time.Time
	MaxTimestamp  time.Time
	BatchSize     int
	NextPageToken []byte
}

GetTimerIndexTasksRequest is the request for GetTimerIndexTasks TODO: replace this with an iterator that can configure min and max index.

type GetTimerIndexTasksResponse

type GetTimerIndexTasksResponse struct {
	Timers        []*TimerTaskInfo
	NextPageToken []byte
}

GetTimerIndexTasksResponse is the response for GetTimerIndexTasks

type GetTransferTasksRequest

type GetTransferTasksRequest struct {
	ReadLevel     int64
	MaxReadLevel  int64
	BatchSize     int
	NextPageToken []byte
}

GetTransferTasksRequest is used to read tasks from the transfer task queue

type GetTransferTasksResponse

type GetTransferTasksResponse struct {
	Tasks         []*TransferTaskInfo
	NextPageToken []byte
}

GetTransferTasksResponse is the response to GetTransferTasksRequest

type GetWorkflowExecutionHistoryByBatchResponse added in v0.5.0

type GetWorkflowExecutionHistoryByBatchResponse struct {
	History []*workflow.History
	// Token to read next page if there are more events beyond page size.
	// Use this to set NextPageToken on GetWorkflowExecutionHistoryRequest to read the next page.
	NextPageToken []byte
	// the first_event_id of last loaded batch
	LastFirstEventID int64
	// Size of history read from store
	Size int
}

GetWorkflowExecutionHistoryByBatchResponse is the response to GetWorkflowExecutionHistoryRequest Deprecated: use V2 API instead-ReadHistoryBranchByBatch()

type GetWorkflowExecutionHistoryRequest

type GetWorkflowExecutionHistoryRequest struct {
	DomainID  string
	Execution workflow.WorkflowExecution
	// Get the history events from FirstEventID. Inclusive.
	FirstEventID int64
	// Get the history events upto NextEventID.  Not Inclusive.
	NextEventID int64
	// Maximum number of history append transactions per page
	PageSize int
	// Token to continue reading next page of history append transactions.  Pass in empty slice for first page
	NextPageToken []byte
}

GetWorkflowExecutionHistoryRequest is used to retrieve history of a workflow execution Deprecated: use v2 API-AppendHistoryNodes() instead

type GetWorkflowExecutionHistoryResponse

type GetWorkflowExecutionHistoryResponse struct {
	History *workflow.History
	// Token to read next page if there are more events beyond page size.
	// Use this to set NextPageToken on GetWorkflowExecutionHistoryRequest to read the next page.
	NextPageToken []byte
	// the first_event_id of last loaded batch
	LastFirstEventID int64
	// Size of history read from store
	Size int
}

GetWorkflowExecutionHistoryResponse is the response to GetWorkflowExecutionHistoryRequest Deprecated: use V2 API instead-ReadHistoryBranch()

type GetWorkflowExecutionRequest

type GetWorkflowExecutionRequest struct {
	DomainID  string
	Execution workflow.WorkflowExecution
}

GetWorkflowExecutionRequest is used to retrieve the info of a workflow execution

type GetWorkflowExecutionResponse

type GetWorkflowExecutionResponse struct {
	State             *WorkflowMutableState
	MutableStateStats *MutableStateStats
}

GetWorkflowExecutionResponse is the response to GetworkflowExecutionRequest

type HistoryBranchDetail added in v0.9.0

type HistoryBranchDetail struct {
	TreeID   string
	BranchID string
	ForkTime time.Time
	Info     string
}

HistoryBranchDetail contains detailed information of a branch

type HistoryManager

type HistoryManager interface {
	Closeable
	GetName() string

	// Deprecated: use v2 API-AppendHistoryNodes() instead
	AppendHistoryEvents(request *AppendHistoryEventsRequest) (*AppendHistoryEventsResponse, error)
	// GetWorkflowExecutionHistory retrieves the paginated list of history events for given execution
	// Deprecated: use v2 API-ReadHistoryBranch() instead
	GetWorkflowExecutionHistory(request *GetWorkflowExecutionHistoryRequest) (*GetWorkflowExecutionHistoryResponse, error)
	// Deprecated: use v2 API-ReadHistoryBranchByBatch() instead
	GetWorkflowExecutionHistoryByBatch(request *GetWorkflowExecutionHistoryRequest) (*GetWorkflowExecutionHistoryByBatchResponse, error)
	// Deprecated: use v2 API-DeleteHistoryBranch instead
	DeleteWorkflowExecutionHistory(request *DeleteWorkflowExecutionHistoryRequest) error
}

HistoryManager is used to manage Workflow Execution HistoryEventBatch Deprecated: use HistoryV2Manager instead

func NewHistoryManagerImpl added in v0.4.0

func NewHistoryManagerImpl(persistence HistoryStore, logger log.Logger, transactionSizeLimit dynamicconfig.IntPropertyFn) HistoryManager

NewHistoryManagerImpl returns new HistoryManager

func NewHistoryPersistenceMetricsClient added in v0.3.14

func NewHistoryPersistenceMetricsClient(persistence HistoryManager, metricClient metrics.Client, logger log.Logger) HistoryManager

NewHistoryPersistenceMetricsClient creates a HistoryManager client to manage workflow execution history

func NewHistoryPersistenceRateLimitedClient added in v0.3.14

func NewHistoryPersistenceRateLimitedClient(persistence HistoryManager, rateLimiter quotas.Limiter, logger log.Logger) HistoryManager

NewHistoryPersistenceRateLimitedClient creates a HistoryManager client to manage workflow execution history

type HistoryReplicationTask added in v0.3.11

type HistoryReplicationTask struct {
	VisibilityTimestamp     time.Time
	TaskID                  int64
	FirstEventID            int64
	NextEventID             int64
	Version                 int64
	LastReplicationInfo     map[string]*ReplicationInfo
	EventStoreVersion       int32
	BranchToken             []byte
	ResetWorkflow           bool
	NewRunEventStoreVersion int32
	NewRunBranchToken       []byte
}

HistoryReplicationTask is the replication task created for shipping history replication events to other clusters

func (*HistoryReplicationTask) GetTaskID added in v0.3.11

func (a *HistoryReplicationTask) GetTaskID() int64

GetTaskID returns the sequence ID of the history replication task

func (*HistoryReplicationTask) GetType added in v0.3.11

func (a *HistoryReplicationTask) GetType() int

GetType returns the type of the history replication task

func (*HistoryReplicationTask) GetVersion added in v0.3.12

func (a *HistoryReplicationTask) GetVersion() int64

GetVersion returns the version of the history replication task

func (*HistoryReplicationTask) GetVisibilityTimestamp added in v0.3.14

func (a *HistoryReplicationTask) GetVisibilityTimestamp() time.Time

GetVisibilityTimestamp get the visibility timestamp

func (*HistoryReplicationTask) SetTaskID added in v0.3.11

func (a *HistoryReplicationTask) SetTaskID(id int64)

SetTaskID sets the sequence ID of the history replication task

func (*HistoryReplicationTask) SetVersion added in v0.3.12

func (a *HistoryReplicationTask) SetVersion(version int64)

SetVersion returns the version of the history replication task

func (*HistoryReplicationTask) SetVisibilityTimestamp added in v0.3.14

func (a *HistoryReplicationTask) SetVisibilityTimestamp(timestamp time.Time)

SetVisibilityTimestamp set the visibility timestamp

type HistoryStore added in v0.4.0

type HistoryStore interface {
	Closeable
	GetName() string

	//DEPRECATED in favor of V2 APIs-AppendHistoryNodes
	AppendHistoryEvents(request *InternalAppendHistoryEventsRequest) error
	//DEPRECATED in favor of V2 APIs-ReadHistoryBranch
	GetWorkflowExecutionHistory(request *InternalGetWorkflowExecutionHistoryRequest) (*InternalGetWorkflowExecutionHistoryResponse, error)
	//DEPRECATED in favor of V2 APIs-DeleteHistoryBranch
	DeleteWorkflowExecutionHistory(request *DeleteWorkflowExecutionHistoryRequest) error
}

HistoryStore is used to manage Workflow Execution HistoryEventBatch for Persistence layer DEPRECATED: use HistoryV2Store instead

type HistoryV2Manager added in v0.5.0

type HistoryV2Manager interface {
	Closeable
	GetName() string

	// AppendHistoryNodes add(or override) a batch of nodes to a history branch
	AppendHistoryNodes(request *AppendHistoryNodesRequest) (*AppendHistoryNodesResponse, error)
	// ReadHistoryBranch returns history node data for a branch
	ReadHistoryBranch(request *ReadHistoryBranchRequest) (*ReadHistoryBranchResponse, error)
	// ReadHistoryBranchByBatch returns history node data for a branch ByBatch
	ReadHistoryBranchByBatch(request *ReadHistoryBranchRequest) (*ReadHistoryBranchByBatchResponse, error)
	// ReadRawHistoryBranch returns history node raw data for a branch ByBatch
	// NOTE: this API should only be used by 3+DC
	ReadRawHistoryBranch(request *ReadHistoryBranchRequest) (*ReadRawHistoryBranchResponse, error)
	// ForkHistoryBranch forks a new branch from a old branch
	ForkHistoryBranch(request *ForkHistoryBranchRequest) (*ForkHistoryBranchResponse, error)
	// CompleteForkBranch will complete the forking process after update mutableState, this is to help preventing data leakage
	CompleteForkBranch(request *CompleteForkBranchRequest) error
	// DeleteHistoryBranch removes a branch
	// If this is the last branch to delete, it will also remove the root node
	DeleteHistoryBranch(request *DeleteHistoryBranchRequest) error
	// GetHistoryTree returns all branch information of a tree
	GetHistoryTree(request *GetHistoryTreeRequest) (*GetHistoryTreeResponse, error)
	// GetAllHistoryTreeBranches returns all branches of all trees
	GetAllHistoryTreeBranches(request *GetAllHistoryTreeBranchesRequest) (*GetAllHistoryTreeBranchesResponse, error)
}

HistoryV2Manager is used to manager workflow history events

func NewHistoryV2ManagerImpl added in v0.5.0

func NewHistoryV2ManagerImpl(
	persistence HistoryV2Store,
	logger log.Logger,
	transactionSizeLimit dynamicconfig.IntPropertyFn,
) HistoryV2Manager

NewHistoryV2ManagerImpl returns new HistoryManager

func NewHistoryV2PersistenceMetricsClient added in v0.5.0

func NewHistoryV2PersistenceMetricsClient(persistence HistoryV2Manager, metricClient metrics.Client, logger log.Logger) HistoryV2Manager

NewHistoryV2PersistenceMetricsClient creates a HistoryManager client to manage workflow execution history

func NewHistoryV2PersistenceRateLimitedClient added in v0.5.0

func NewHistoryV2PersistenceRateLimitedClient(persistence HistoryV2Manager, rateLimiter quotas.Limiter, logger log.Logger) HistoryV2Manager

NewHistoryV2PersistenceRateLimitedClient creates a HistoryManager client to manage workflow execution history

type HistoryV2Store added in v0.5.0

type HistoryV2Store interface {
	Closeable
	GetName() string

	// AppendHistoryNodes add(or override) a node to a history branch
	AppendHistoryNodes(request *InternalAppendHistoryNodesRequest) error
	// ReadHistoryBranch returns history node data for a branch
	ReadHistoryBranch(request *InternalReadHistoryBranchRequest) (*InternalReadHistoryBranchResponse, error)
	// ForkHistoryBranch forks a new branch from a old branch
	ForkHistoryBranch(request *InternalForkHistoryBranchRequest) (*InternalForkHistoryBranchResponse, error)
	// DeleteHistoryBranch removes a branch
	DeleteHistoryBranch(request *InternalDeleteHistoryBranchRequest) error
	// UpdateHistoryBranch update a branch
	CompleteForkBranch(request *InternalCompleteForkBranchRequest) error
	// GetHistoryTree returns all branch information of a tree
	GetHistoryTree(request *GetHistoryTreeRequest) (*GetHistoryTreeResponse, error)
	// GetAllHistoryTreeBranches returns all branches of all trees
	GetAllHistoryTreeBranches(request *GetAllHistoryTreeBranchesRequest) (*GetAllHistoryTreeBranchesResponse, error)
}

HistoryV2Store is to manager workflow history events

type InternalActivityInfo added in v0.4.0

type InternalActivityInfo struct {
	Version                  int64
	ScheduleID               int64
	ScheduledEventBatchID    int64
	ScheduledEvent           *DataBlob
	ScheduledTime            time.Time
	StartedID                int64
	StartedEvent             *DataBlob
	StartedTime              time.Time
	ActivityID               string
	RequestID                string
	Details                  []byte
	ScheduleToStartTimeout   int32
	ScheduleToCloseTimeout   int32
	StartToCloseTimeout      int32
	HeartbeatTimeout         int32
	CancelRequested          bool
	CancelRequestID          int64
	LastHeartBeatUpdatedTime time.Time
	TimerTaskStatus          int32
	// For retry
	Attempt            int32
	DomainID           string
	StartedIdentity    string
	TaskList           string
	HasRetryPolicy     bool
	InitialInterval    int32
	BackoffCoefficient float64
	MaximumInterval    int32
	ExpirationTime     time.Time
	MaximumAttempts    int32
	NonRetriableErrors []string
	LastFailureReason  string
	LastWorkerIdentity string
	LastFailureDetails []byte
	// Not written to database - This is used only for deduping heartbeat timer creation
	LastHeartbeatTimeoutVisibility int64
}

InternalActivityInfo details for Persistence Interface

type InternalAppendHistoryEventsRequest added in v0.4.0

type InternalAppendHistoryEventsRequest struct {
	DomainID          string
	Execution         workflow.WorkflowExecution
	FirstEventID      int64
	EventBatchVersion int64
	RangeID           int64
	TransactionID     int64
	Events            *DataBlob
	Overwrite         bool
}

InternalAppendHistoryEventsRequest is used to append new events to workflow execution history for Persistence Interface

type InternalAppendHistoryNodesRequest added in v0.5.0

type InternalAppendHistoryNodesRequest struct {
	// True if it is the first append request to the branch
	IsNewBranch bool
	// The info for clean up data in background
	Info string
	// The branch to be appended
	BranchInfo workflow.HistoryBranch
	// The first eventID becomes the nodeID to be appended
	NodeID int64
	// The events to be appended
	Events *DataBlob
	// Requested TransactionID for conditional update
	TransactionID int64
	// Used in sharded data stores to identify which shard to use
	ShardID int
}

InternalAppendHistoryNodesRequest is used to append a batch of history nodes

type InternalChildExecutionInfo added in v0.4.0

type InternalChildExecutionInfo struct {
	Version               int64
	InitiatedID           int64
	InitiatedEventBatchID int64
	InitiatedEvent        *DataBlob
	StartedID             int64
	StartedWorkflowID     string
	StartedRunID          string
	StartedEvent          *DataBlob
	CreateRequestID       string
	DomainName            string
	WorkflowTypeName      string
	ParentClosePolicy     workflow.ParentClosePolicy
}

InternalChildExecutionInfo has details for pending child executions for Persistence Interface

type InternalCompleteForkBranchRequest added in v0.5.2

type InternalCompleteForkBranchRequest struct {
	// branch to be updated
	BranchInfo workflow.HistoryBranch
	// whether fork is successful
	Success bool
	// Used in sharded data stores to identify which shard to use
	ShardID int
}

InternalCompleteForkBranchRequest is used to update some tree/branch meta data for forking

type InternalConflictResolveWorkflowExecutionRequest added in v0.7.0

type InternalConflictResolveWorkflowExecutionRequest struct {
	RangeID int64

	// previous workflow information
	PrevRunID            string
	PrevLastWriteVersion int64
	PrevState            int

	// workflow to be resetted
	ResetWorkflowSnapshot InternalWorkflowSnapshot

	// current workflow
	CurrentWorkflowMutation *InternalWorkflowMutation
}

InternalConflictResolveWorkflowExecutionRequest is used to reset workflow execution state for Persistence Interface

type InternalCreateDomainRequest added in v0.5.8

type InternalCreateDomainRequest struct {
	Info              *DomainInfo
	Config            *InternalDomainConfig
	ReplicationConfig *DomainReplicationConfig
	IsGlobalDomain    bool
	ConfigVersion     int64
	FailoverVersion   int64
}

InternalCreateDomainRequest is used to create the domain

type InternalCreateWorkflowExecutionRequest added in v0.5.7

type InternalCreateWorkflowExecutionRequest struct {
	RangeID int64

	CreateWorkflowMode int

	PreviousRunID            string
	PreviousLastWriteVersion int64

	NewWorkflowSnapshot InternalWorkflowSnapshot
}

InternalCreateWorkflowExecutionRequest is used to write a new workflow execution

type InternalDeleteHistoryBranchRequest added in v0.5.0

type InternalDeleteHistoryBranchRequest struct {
	// branch to be deleted
	BranchInfo workflow.HistoryBranch
	// Used in sharded data stores to identify which shard to use
	ShardID int
}

InternalDeleteHistoryBranchRequest is used to remove a history branch

type InternalDomainConfig added in v0.5.8

type InternalDomainConfig struct {
	// NOTE: this retention is in days, not in seconds
	Retention                int32
	EmitMetric               bool
	ArchivalBucket           string                  // deprecated
	ArchivalStatus           workflow.ArchivalStatus // deprecated
	HistoryArchivalStatus    workflow.ArchivalStatus
	HistoryArchivalURI       string
	VisibilityArchivalStatus workflow.ArchivalStatus
	VisibilityArchivalURI    string
	BadBinaries              *DataBlob
}

InternalDomainConfig describes the domain configuration

type InternalForkHistoryBranchRequest added in v0.5.0

type InternalForkHistoryBranchRequest struct {
	// The base branch to fork from
	ForkBranchInfo workflow.HistoryBranch
	// The nodeID to fork from, the new branch will start from ( inclusive ), the base branch will stop at(exclusive)
	ForkNodeID int64
	// branchID of the new branch
	NewBranchID string
	// the info for clean up data in background
	Info string
	// Used in sharded data stores to identify which shard to use
	ShardID int
}

InternalForkHistoryBranchRequest is used to fork a history branch

type InternalForkHistoryBranchResponse added in v0.5.0

type InternalForkHistoryBranchResponse struct {
	// branchInfo to represent the new branch
	NewBranchInfo workflow.HistoryBranch
}

InternalForkHistoryBranchResponse is the response to ForkHistoryBranchRequest

type InternalGetClosedWorkflowExecutionResponse added in v0.5.7

type InternalGetClosedWorkflowExecutionResponse struct {
	Execution *VisibilityWorkflowExecutionInfo
}

InternalGetClosedWorkflowExecutionResponse is response from GetWorkflowExecution

type InternalGetDomainResponse added in v0.5.8

type InternalGetDomainResponse struct {
	Info                        *DomainInfo
	Config                      *InternalDomainConfig
	ReplicationConfig           *DomainReplicationConfig
	IsGlobalDomain              bool
	ConfigVersion               int64
	FailoverVersion             int64
	FailoverNotificationVersion int64
	NotificationVersion         int64
	TableVersion                int
}

InternalGetDomainResponse is the response for GetDomain

type InternalGetWorkflowExecutionHistoryRequest added in v0.4.0

type InternalGetWorkflowExecutionHistoryRequest struct {
	// an extra field passing from GetWorkflowExecutionHistoryRequest
	LastEventBatchVersion int64

	DomainID  string
	Execution workflow.WorkflowExecution
	// Get the history events from FirstEventID. Inclusive.
	FirstEventID int64
	// Get the history events upto NextEventID.  Not Inclusive.
	NextEventID int64
	// Maximum number of history append transactions per page
	PageSize int
	// Token to continue reading next page of history append transactions.  Pass in empty slice for first page
	NextPageToken []byte
}

InternalGetWorkflowExecutionHistoryRequest is used to retrieve history of a workflow execution

type InternalGetWorkflowExecutionHistoryResponse added in v0.4.0

type InternalGetWorkflowExecutionHistoryResponse struct {
	History []*DataBlob
	// Token to read next page if there are more events beyond page size.
	// Use this to set NextPageToken on GetworkflowExecutionHistoryRequest to read the next page.
	NextPageToken []byte
	// an extra field passing to DataInterface
	LastEventBatchVersion int64
}

InternalGetWorkflowExecutionHistoryResponse is the response to GetWorkflowExecutionHistoryRequest for Persistence Interface

type InternalGetWorkflowExecutionResponse added in v0.4.0

type InternalGetWorkflowExecutionResponse struct {
	State *InternalWorkflowMutableState
}

InternalGetWorkflowExecutionResponse is the response to GetworkflowExecutionRequest for Persistence Interface

type InternalListDomainsResponse added in v0.5.8

type InternalListDomainsResponse struct {
	Domains       []*InternalGetDomainResponse
	NextPageToken []byte
}

InternalListDomainsResponse is the response for GetDomain

type InternalListWorkflowExecutionsResponse added in v0.5.7

type InternalListWorkflowExecutionsResponse struct {
	Executions []*VisibilityWorkflowExecutionInfo
	// Token to read next page if there are more workflow executions beyond page size.
	// Use this to set NextPageToken on ListWorkflowExecutionsRequest to read the next page.
	NextPageToken []byte
}

InternalListWorkflowExecutionsResponse is response from ListWorkflowExecutions

type InternalReadHistoryBranchRequest added in v0.5.0

type InternalReadHistoryBranchRequest struct {
	// The tree of branch range to be read
	TreeID string
	// The branch range to be read
	BranchID string
	// Get the history nodes from MinNodeID. Inclusive.
	MinNodeID int64
	// Get the history nodes upto MaxNodeID.  Exclusive.
	MaxNodeID int64
	// passing thru for pagination
	PageSize int
	// Pagination token
	NextPageToken []byte
	// LastNodeID is the last known node ID attached to a history node
	LastNodeID int64
	// LastTransactionID is the last known transaction ID attached to a history node
	LastTransactionID int64
	// Used in sharded data stores to identify which shard to use
	ShardID int
}

InternalReadHistoryBranchRequest is used to read a history branch

type InternalReadHistoryBranchResponse added in v0.5.0

type InternalReadHistoryBranchResponse struct {
	// History events
	History []*DataBlob
	// Pagination token
	NextPageToken []byte
	// LastNodeID is the last known node ID attached to a history node
	LastNodeID int64
	// LastTransactionID is the last known transaction ID attached to a history node
	LastTransactionID int64
}

InternalReadHistoryBranchResponse is the response to ReadHistoryBranchRequest

type InternalRecordWorkflowExecutionClosedRequest added in v0.5.7

type InternalRecordWorkflowExecutionClosedRequest struct {
	DomainUUID         string
	WorkflowID         string
	RunID              string
	WorkflowTypeName   string
	StartTimestamp     int64
	ExecutionTimestamp int64
	TaskID             int64
	Memo               *DataBlob
	SearchAttributes   map[string][]byte
	CloseTimestamp     int64
	Status             workflow.WorkflowExecutionCloseStatus
	HistoryLength      int64
	RetentionSeconds   int64
}

InternalRecordWorkflowExecutionClosedRequest is request to RecordWorkflowExecutionClosed

type InternalRecordWorkflowExecutionStartedRequest added in v0.5.7

type InternalRecordWorkflowExecutionStartedRequest struct {
	DomainUUID         string
	WorkflowID         string
	RunID              string
	WorkflowTypeName   string
	StartTimestamp     int64
	ExecutionTimestamp int64
	WorkflowTimeout    int64
	TaskID             int64
	Memo               *DataBlob
	SearchAttributes   map[string][]byte
}

InternalRecordWorkflowExecutionStartedRequest request to RecordWorkflowExecutionStarted

type InternalResetWorkflowExecutionRequest added in v0.5.2

type InternalResetWorkflowExecutionRequest struct {
	RangeID int64

	// for base run (we need to make sure the baseRun hasn't been deleted after forking)
	BaseRunID          string
	BaseRunNextEventID int64

	// for current workflow record
	CurrentRunID          string
	CurrentRunNextEventID int64

	// for current mutable state
	CurrentWorkflowMutation *InternalWorkflowMutation

	// For new mutable state
	NewWorkflowSnapshot InternalWorkflowSnapshot
}

InternalResetWorkflowExecutionRequest is used to reset workflow execution state for Persistence Interface

type InternalUpdateDomainRequest added in v0.5.8

type InternalUpdateDomainRequest struct {
	Info                        *DomainInfo
	Config                      *InternalDomainConfig
	ReplicationConfig           *DomainReplicationConfig
	ConfigVersion               int64
	FailoverVersion             int64
	FailoverNotificationVersion int64
	NotificationVersion         int64
	TableVersion                int
}

InternalUpdateDomainRequest is used to update domain

type InternalUpdateWorkflowExecutionRequest added in v0.4.0

type InternalUpdateWorkflowExecutionRequest struct {
	RangeID int64

	UpdateWorkflowMutation InternalWorkflowMutation

	NewWorkflowSnapshot *InternalWorkflowSnapshot
}

InternalUpdateWorkflowExecutionRequest is used to update a workflow execution for Persistence Interface

type InternalUpsertWorkflowExecutionRequest added in v0.6.0

type InternalUpsertWorkflowExecutionRequest struct {
	DomainUUID         string
	WorkflowID         string
	RunID              string
	WorkflowTypeName   string
	StartTimestamp     int64
	ExecutionTimestamp int64
	WorkflowTimeout    int64
	TaskID             int64
	Memo               *DataBlob
	SearchAttributes   map[string][]byte
}

InternalUpsertWorkflowExecutionRequest is request to UpsertWorkflowExecution

type InternalWorkflowExecutionInfo added in v0.4.0

type InternalWorkflowExecutionInfo struct {
	DomainID                           string
	WorkflowID                         string
	RunID                              string
	ParentDomainID                     string
	ParentWorkflowID                   string
	ParentRunID                        string
	InitiatedID                        int64
	CompletionEventBatchID             int64
	CompletionEvent                    *DataBlob
	TaskList                           string
	WorkflowTypeName                   string
	WorkflowTimeout                    int32
	DecisionTimeoutValue               int32
	ExecutionContext                   []byte
	State                              int
	CloseStatus                        int
	LastFirstEventID                   int64
	LastEventTaskID                    int64
	NextEventID                        int64
	LastProcessedEvent                 int64
	StartTimestamp                     time.Time
	LastUpdatedTimestamp               time.Time
	CreateRequestID                    string
	SignalCount                        int32
	DecisionVersion                    int64
	DecisionScheduleID                 int64
	DecisionStartedID                  int64
	DecisionRequestID                  string
	DecisionTimeout                    int32
	DecisionAttempt                    int64
	DecisionStartedTimestamp           int64
	DecisionScheduledTimestamp         int64
	DecisionOriginalScheduledTimestamp int64
	CancelRequested                    bool
	CancelRequestID                    string
	StickyTaskList                     string
	StickyScheduleToStartTimeout       int32
	ClientLibraryVersion               string
	ClientFeatureVersion               string
	ClientImpl                         string
	AutoResetPoints                    *DataBlob
	// for retry
	Attempt            int32
	HasRetryPolicy     bool
	InitialInterval    int32
	BackoffCoefficient float64
	MaximumInterval    int32
	ExpirationTime     time.Time
	MaximumAttempts    int32
	NonRetriableErrors []string
	// events V2 related
	EventStoreVersion int32
	BranchToken       []byte
	CronSchedule      string
	ExpirationSeconds int32
	Memo              map[string][]byte
	SearchAttributes  map[string][]byte

	// attributes which are not related to mutable state at all
	HistorySize int64
}

InternalWorkflowExecutionInfo describes a workflow execution for Persistence Interface

type InternalWorkflowMutableState added in v0.4.0

type InternalWorkflowMutableState struct {
	ActivitInfos        map[int64]*InternalActivityInfo
	TimerInfos          map[string]*TimerInfo
	ChildExecutionInfos map[int64]*InternalChildExecutionInfo
	RequestCancelInfos  map[int64]*RequestCancelInfo
	SignalInfos         map[int64]*SignalInfo
	SignalRequestedIDs  map[string]struct{}
	ExecutionInfo       *InternalWorkflowExecutionInfo
	ReplicationState    *ReplicationState
	BufferedEvents      []*DataBlob
}

InternalWorkflowMutableState indicates workflow related state for Persistence Interface

type InternalWorkflowMutation added in v0.6.0

type InternalWorkflowMutation struct {
	ExecutionInfo    *InternalWorkflowExecutionInfo
	ReplicationState *ReplicationState

	UpsertActivityInfos       []*InternalActivityInfo
	DeleteActivityInfos       []int64
	UpserTimerInfos           []*TimerInfo
	DeleteTimerInfos          []string
	UpsertChildExecutionInfos []*InternalChildExecutionInfo
	DeleteChildExecutionInfo  *int64
	UpsertRequestCancelInfos  []*RequestCancelInfo
	DeleteRequestCancelInfo   *int64
	UpsertSignalInfos         []*SignalInfo
	DeleteSignalInfo          *int64
	UpsertSignalRequestedIDs  []string
	DeleteSignalRequestedID   string
	NewBufferedEvents         *DataBlob
	ClearBufferedEvents       bool

	TransferTasks    []Task
	TimerTasks       []Task
	ReplicationTasks []Task

	Condition int64
}

InternalWorkflowMutation is used as generic workflow execution state mutation for Persistence Interface

type InternalWorkflowSnapshot added in v0.6.0

type InternalWorkflowSnapshot struct {
	ExecutionInfo    *InternalWorkflowExecutionInfo
	ReplicationState *ReplicationState

	ActivityInfos       []*InternalActivityInfo
	TimerInfos          []*TimerInfo
	ChildExecutionInfos []*InternalChildExecutionInfo
	RequestCancelInfos  []*RequestCancelInfo
	SignalInfos         []*SignalInfo
	SignalRequestedIDs  []string

	TransferTasks    []Task
	TimerTasks       []Task
	ReplicationTasks []Task

	Condition int64
}

InternalWorkflowSnapshot is used as generic workflow execution state snapshot for Persistence Interface

type InvalidPersistenceRequestError added in v0.5.0

type InvalidPersistenceRequestError struct {
	Msg string
}

InvalidPersistenceRequestError represents invalid request to persistence

func (*InvalidPersistenceRequestError) Error added in v0.5.0

type LeaseTaskListRequest

type LeaseTaskListRequest struct {
	DomainID     string
	TaskList     string
	TaskType     int
	TaskListKind int
	RangeID      int64
}

LeaseTaskListRequest is used to request lease of a task list

type LeaseTaskListResponse

type LeaseTaskListResponse struct {
	TaskListInfo *TaskListInfo
}

LeaseTaskListResponse is response to LeaseTaskListRequest

type ListClosedWorkflowExecutionsByStatusRequest

type ListClosedWorkflowExecutionsByStatusRequest struct {
	ListWorkflowExecutionsRequest
	Status s.WorkflowExecutionCloseStatus
}

ListClosedWorkflowExecutionsByStatusRequest is used to list executions that have specific close status

type ListDomainsRequest added in v0.3.14

type ListDomainsRequest struct {
	PageSize      int
	NextPageToken []byte
}

ListDomainsRequest is used to list domains

type ListDomainsResponse added in v0.3.14

type ListDomainsResponse struct {
	Domains       []*GetDomainResponse
	NextPageToken []byte
}

ListDomainsResponse is the response for GetDomain

type ListTaskListRequest added in v0.5.4

type ListTaskListRequest struct {
	PageSize  int
	PageToken []byte
}

ListTaskListRequest contains the request params needed to invoke ListTaskList API

type ListTaskListResponse added in v0.5.4

type ListTaskListResponse struct {
	Items         []TaskListInfo
	NextPageToken []byte
}

ListTaskListResponse is the response from ListTaskList API

type ListWorkflowExecutionsByTypeRequest

type ListWorkflowExecutionsByTypeRequest struct {
	ListWorkflowExecutionsRequest
	WorkflowTypeName string
}

ListWorkflowExecutionsByTypeRequest is used to list executions of a specific type in a domain

type ListWorkflowExecutionsByWorkflowIDRequest

type ListWorkflowExecutionsByWorkflowIDRequest struct {
	ListWorkflowExecutionsRequest
	WorkflowID string
}

ListWorkflowExecutionsByWorkflowIDRequest is used to list executions that have specific WorkflowID in a domain

type ListWorkflowExecutionsRequest

type ListWorkflowExecutionsRequest struct {
	DomainUUID        string
	Domain            string // domain name is not persisted, but used as config filter key
	EarliestStartTime int64
	LatestStartTime   int64
	// Maximum number of workflow executions per page
	PageSize int
	// Token to continue reading next page of workflow executions.
	// Pass in empty slice for first page.
	NextPageToken []byte
}

ListWorkflowExecutionsRequest is used to list executions in a domain

type ListWorkflowExecutionsRequestV2 added in v0.5.7

type ListWorkflowExecutionsRequestV2 struct {
	DomainUUID string
	Domain     string // domain name is not persisted, but used as config filter key
	PageSize   int    // Maximum number of workflow executions per page
	// Token to continue reading next page of workflow executions.
	// Pass in empty slice for first page.
	NextPageToken []byte
	Query         string
}

ListWorkflowExecutionsRequestV2 is used to list executions in a domain

type ListWorkflowExecutionsResponse

type ListWorkflowExecutionsResponse struct {
	Executions []*s.WorkflowExecutionInfo
	// Token to read next page if there are more workflow executions beyond page size.
	// Use this to set NextPageToken on ListWorkflowExecutionsRequest to read the next page.
	NextPageToken []byte
}

ListWorkflowExecutionsResponse is the response to ListWorkflowExecutionsRequest

type MetadataManager

type MetadataManager interface {
	Closeable
	GetName() string
	CreateDomain(request *CreateDomainRequest) (*CreateDomainResponse, error)
	GetDomain(request *GetDomainRequest) (*GetDomainResponse, error)
	UpdateDomain(request *UpdateDomainRequest) error
	DeleteDomain(request *DeleteDomainRequest) error
	DeleteDomainByName(request *DeleteDomainByNameRequest) error
	ListDomains(request *ListDomainsRequest) (*ListDomainsResponse, error)
	GetMetadata() (*GetMetadataResponse, error)
}

MetadataManager is used to manage metadata CRUD for domain entities

func NewMetadataManagerImpl added in v0.5.8

func NewMetadataManagerImpl(persistence MetadataStore, logger log.Logger) MetadataManager

NewMetadataManagerImpl returns new MetadataManager

func NewMetadataPersistenceMetricsClient added in v0.3.14

func NewMetadataPersistenceMetricsClient(persistence MetadataManager, metricClient metrics.Client, logger log.Logger) MetadataManager

NewMetadataPersistenceMetricsClient creates a MetadataManager client to manage metadata

func NewMetadataPersistenceRateLimitedClient added in v0.3.14

func NewMetadataPersistenceRateLimitedClient(persistence MetadataManager, rateLimiter quotas.Limiter, logger log.Logger) MetadataManager

NewMetadataPersistenceRateLimitedClient creates a MetadataManager client to manage metadata

type MetadataStore added in v0.4.0

type MetadataStore interface {
	Closeable
	GetName() string
	CreateDomain(request *InternalCreateDomainRequest) (*CreateDomainResponse, error)
	GetDomain(request *GetDomainRequest) (*InternalGetDomainResponse, error)
	UpdateDomain(request *InternalUpdateDomainRequest) error
	DeleteDomain(request *DeleteDomainRequest) error
	DeleteDomainByName(request *DeleteDomainByNameRequest) error
	ListDomains(request *ListDomainsRequest) (*InternalListDomainsResponse, error)
	GetMetadata() (*GetMetadataResponse, error)
}

MetadataStore is a lower level of MetadataManager

type MutableStateStats added in v0.4.0

type MutableStateStats struct {
	// Total size of mutable state
	MutableStateSize int

	// Breakdown of size into more granular stats
	ExecutionInfoSize  int
	ActivityInfoSize   int
	TimerInfoSize      int
	ChildInfoSize      int
	SignalInfoSize     int
	BufferedEventsSize int

	// Item count for various information captured within mutable state
	ActivityInfoCount      int
	TimerInfoCount         int
	ChildInfoCount         int
	SignalInfoCount        int
	RequestCancelInfoCount int
	BufferedEventsCount    int
}

MutableStateStats is the size stats for MutableState

type MutableStateUpdateSessionStats added in v0.4.0

type MutableStateUpdateSessionStats struct {
	MutableStateSize int // Total size of mutable state update

	// Breakdown of mutable state size update for more granular stats
	ExecutionInfoSize  int
	ActivityInfoSize   int
	TimerInfoSize      int
	ChildInfoSize      int
	SignalInfoSize     int
	BufferedEventsSize int

	// Item counts in this session update
	ActivityInfoCount      int
	TimerInfoCount         int
	ChildInfoCount         int
	SignalInfoCount        int
	RequestCancelInfoCount int

	// Deleted item counts in this session update
	DeleteActivityInfoCount      int
	DeleteTimerInfoCount         int
	DeleteChildInfoCount         int
	DeleteSignalInfoCount        int
	DeleteRequestCancelInfoCount int
}

MutableStateUpdateSessionStats is size stats for mutableState updating session

type PayloadSerializer added in v0.5.7

type PayloadSerializer interface {
	// serialize/deserialize history events
	SerializeBatchEvents(batch []*workflow.HistoryEvent, encodingType common.EncodingType) (*DataBlob, error)
	DeserializeBatchEvents(data *DataBlob) ([]*workflow.HistoryEvent, error)

	// serialize/deserialize a single history event
	SerializeEvent(event *workflow.HistoryEvent, encodingType common.EncodingType) (*DataBlob, error)
	DeserializeEvent(data *DataBlob) (*workflow.HistoryEvent, error)

	// serialize/deserialize visibility memo fields
	SerializeVisibilityMemo(memo *workflow.Memo, encodingType common.EncodingType) (*DataBlob, error)
	DeserializeVisibilityMemo(data *DataBlob) (*workflow.Memo, error)

	// serialize/deserialize reset points
	SerializeResetPoints(event *workflow.ResetPoints, encodingType common.EncodingType) (*DataBlob, error)
	DeserializeResetPoints(data *DataBlob) (*workflow.ResetPoints, error)

	// serialize/deserialize bad binaries
	SerializeBadBinaries(event *workflow.BadBinaries, encodingType common.EncodingType) (*DataBlob, error)
	DeserializeBadBinaries(data *DataBlob) (*workflow.BadBinaries, error)
}

PayloadSerializer is used by persistence to serialize/deserialize history event(s) and others It will only be used inside persistence, so that serialize/deserialize is transparent for application

func NewPayloadSerializer added in v0.5.7

func NewPayloadSerializer() PayloadSerializer

NewPayloadSerializer returns a PayloadSerializer

type RangeCompleteTimerTaskRequest added in v0.4.0

type RangeCompleteTimerTaskRequest struct {
	InclusiveBeginTimestamp time.Time
	ExclusiveEndTimestamp   time.Time
}

RangeCompleteTimerTaskRequest is used to complete a range of tasks in the timer task queue

type RangeCompleteTransferTaskRequest added in v0.4.0

type RangeCompleteTransferTaskRequest struct {
	ExclusiveBeginTaskID int64
	InclusiveEndTaskID   int64
}

RangeCompleteTransferTaskRequest is used to complete a range of tasks in the transfer task queue

type ReadHistoryBranchByBatchResponse added in v0.5.0

type ReadHistoryBranchByBatchResponse struct {
	// History events by batch
	History []*workflow.History
	// Token to read next page if there are more events beyond page size.
	// Use this to set NextPageToken on ReadHistoryBranchRequest to read the next page.
	// Empty means we have reached the last page, not need to continue
	NextPageToken []byte
	// Size of history read from store
	Size int
	// the first_event_id of last loaded batch
	LastFirstEventID int64
}

ReadHistoryBranchByBatchResponse is the response to ReadHistoryBranchRequest

type ReadHistoryBranchRequest added in v0.5.0

type ReadHistoryBranchRequest struct {
	// The branch to be read
	BranchToken []byte
	// Get the history nodes from MinEventID. Inclusive.
	MinEventID int64
	// Get the history nodes upto MaxEventID.  Exclusive.
	MaxEventID int64
	// Maximum number of batches of events per page. Not that number of events in a batch >=1, it is not number of events per page.
	// However for a single page, it is also possible that the returned events is less than PageSize (event zero events) due to stale events.
	PageSize int
	// Token to continue reading next page of history append transactions.  Pass in empty slice for first page
	NextPageToken []byte
	// The shard to get history branch data
	ShardID *int
}

ReadHistoryBranchRequest is used to read a history branch

type ReadHistoryBranchResponse added in v0.5.0

type ReadHistoryBranchResponse struct {
	// History events
	HistoryEvents []*workflow.HistoryEvent
	// Token to read next page if there are more events beyond page size.
	// Use this to set NextPageToken on ReadHistoryBranchRequest to read the next page.
	// Empty means we have reached the last page, not need to continue
	NextPageToken []byte
	// Size of history read from store
	Size int
	// the first_event_id of last loaded batch
	LastFirstEventID int64
}

ReadHistoryBranchResponse is the response to ReadHistoryBranchRequest

type ReadRawHistoryBranchResponse added in v0.9.0

type ReadRawHistoryBranchResponse struct {
	// HistoryEventBlobs history event blobs
	HistoryEventBlobs []*DataBlob
	// Token to read next page if there are more events beyond page size.
	// Use this to set NextPageToken on ReadHistoryBranchRequest to read the next page.
	// Empty means we have reached the last page, not need to continue
	NextPageToken []byte
	// Size of history read from store
	Size int
}

ReadRawHistoryBranchResponse is the response to ReadHistoryBranchRequest

type RecordWorkflowExecutionClosedRequest

type RecordWorkflowExecutionClosedRequest struct {
	DomainUUID         string
	Domain             string // not persisted, used as config filter key
	Execution          s.WorkflowExecution
	WorkflowTypeName   string
	StartTimestamp     int64
	ExecutionTimestamp int64
	CloseTimestamp     int64
	Status             s.WorkflowExecutionCloseStatus
	HistoryLength      int64
	RetentionSeconds   int64
	TaskID             int64 // not persisted, used as condition update version for ES
	Memo               *s.Memo
	SearchAttributes   map[string][]byte
}

RecordWorkflowExecutionClosedRequest is used to add a record of a newly closed execution

type RecordWorkflowExecutionStartedRequest

type RecordWorkflowExecutionStartedRequest struct {
	DomainUUID         string
	Domain             string // not persisted, used as config filter key
	Execution          s.WorkflowExecution
	WorkflowTypeName   string
	StartTimestamp     int64
	ExecutionTimestamp int64
	WorkflowTimeout    int64 // not persisted, used for cassandra ttl
	TaskID             int64 // not persisted, used as condition update version for ES
	Memo               *s.Memo
	SearchAttributes   map[string][]byte
}

RecordWorkflowExecutionStartedRequest is used to add a record of a newly started execution

type RecordWorkflowStartedTask added in v0.5.7

type RecordWorkflowStartedTask struct {
	VisibilityTimestamp time.Time
	TaskID              int64
	Version             int64
}

RecordWorkflowStartedTask identifites a transfer task for writing visibility open execution record

func (*RecordWorkflowStartedTask) GetTaskID added in v0.5.7

func (a *RecordWorkflowStartedTask) GetTaskID() int64

GetTaskID returns the sequence ID of the record workflow started task

func (*RecordWorkflowStartedTask) GetType added in v0.5.7

func (a *RecordWorkflowStartedTask) GetType() int

GetType returns the type of the record workflow started task

func (*RecordWorkflowStartedTask) GetVersion added in v0.5.7

func (a *RecordWorkflowStartedTask) GetVersion() int64

GetVersion returns the version of the record workflow started task

func (*RecordWorkflowStartedTask) GetVisibilityTimestamp added in v0.5.7

func (a *RecordWorkflowStartedTask) GetVisibilityTimestamp() time.Time

GetVisibilityTimestamp get the visibility timestamp

func (*RecordWorkflowStartedTask) SetTaskID added in v0.5.7

func (a *RecordWorkflowStartedTask) SetTaskID(id int64)

SetTaskID sets the sequence ID of the record workflow started task

func (*RecordWorkflowStartedTask) SetVersion added in v0.5.7

func (a *RecordWorkflowStartedTask) SetVersion(version int64)

SetVersion returns the version of the record workflow started task

func (*RecordWorkflowStartedTask) SetVisibilityTimestamp added in v0.5.7

func (a *RecordWorkflowStartedTask) SetVisibilityTimestamp(timestamp time.Time)

SetVisibilityTimestamp set the visibility timestamp

type ReplicationInfo added in v0.3.11

type ReplicationInfo struct {
	Version     int64
	LastEventID int64
}

ReplicationInfo represents the information stored for last replication event details per cluster

type ReplicationState added in v0.3.11

type ReplicationState struct {
	CurrentVersion      int64
	StartVersion        int64
	LastWriteVersion    int64
	LastWriteEventID    int64
	LastReplicationInfo map[string]*ReplicationInfo
}

ReplicationState represents mutable state information for global domains. This information is used by replication protocol when applying events from remote clusters

type ReplicationTaskInfo added in v0.3.11

type ReplicationTaskInfo struct {
	DomainID                string
	WorkflowID              string
	RunID                   string
	TaskID                  int64
	TaskType                int
	FirstEventID            int64
	NextEventID             int64
	Version                 int64
	LastReplicationInfo     map[string]*ReplicationInfo
	ScheduledID             int64
	EventStoreVersion       int32
	BranchToken             []byte
	NewRunEventStoreVersion int32
	NewRunBranchToken       []byte
	ResetWorkflow           bool
}

ReplicationTaskInfo describes the replication task created for replication of history events

func (*ReplicationTaskInfo) GetDomainID added in v0.9.0

func (t *ReplicationTaskInfo) GetDomainID() string

GetDomainID returns the domain ID for replication task

func (*ReplicationTaskInfo) GetRunID added in v0.9.0

func (t *ReplicationTaskInfo) GetRunID() string

GetRunID returns the run ID for replication task

func (*ReplicationTaskInfo) GetTaskID added in v0.3.11

func (t *ReplicationTaskInfo) GetTaskID() int64

GetTaskID returns the task ID for replication task

func (*ReplicationTaskInfo) GetTaskType added in v0.3.11

func (t *ReplicationTaskInfo) GetTaskType() int

GetTaskType returns the task type for replication task

func (*ReplicationTaskInfo) GetVersion added in v0.3.12

func (t *ReplicationTaskInfo) GetVersion() int64

GetVersion returns the task version for replication task

func (*ReplicationTaskInfo) GetVisibilityTimestamp added in v0.3.14

func (t *ReplicationTaskInfo) GetVisibilityTimestamp() time.Time

GetVisibilityTimestamp returns the task type for replication task

func (*ReplicationTaskInfo) GetWorkflowID added in v0.9.0

func (t *ReplicationTaskInfo) GetWorkflowID() string

GetWorkflowID returns the workflow ID for replication task

type RequestCancelInfo

type RequestCancelInfo struct {
	Version               int64
	InitiatedEventBatchID int64
	InitiatedID           int64
	CancelRequestID       string
}

RequestCancelInfo has details for pending external workflow cancellations

type ResetWorkflowExecutionRequest added in v0.5.2

type ResetWorkflowExecutionRequest struct {
	RangeID int64

	// for base run (we need to make sure the baseRun hasn't been deleted after forking)
	BaseRunID          string
	BaseRunNextEventID int64

	// for current workflow record
	CurrentRunID          string
	CurrentRunNextEventID int64

	// for current mutable state
	CurrentWorkflowMutation *WorkflowMutation

	// For new mutable state
	NewWorkflowSnapshot WorkflowSnapshot

	Encoding common.EncodingType // optional binary encoding type
}

ResetWorkflowExecutionRequest is used to reset workflow execution state for current run and create new run

type ResetWorkflowTask added in v0.5.8

type ResetWorkflowTask struct {
	VisibilityTimestamp time.Time
	TaskID              int64
	Version             int64
}

ResetWorkflowTask identifites a transfer task to reset workflow

func (*ResetWorkflowTask) GetTaskID added in v0.5.8

func (a *ResetWorkflowTask) GetTaskID() int64

GetTaskID returns the sequence ID of the ResetWorkflowTask

func (*ResetWorkflowTask) GetType added in v0.5.8

func (a *ResetWorkflowTask) GetType() int

GetType returns the type of the ResetWorkflowTask

func (*ResetWorkflowTask) GetVersion added in v0.5.8

func (a *ResetWorkflowTask) GetVersion() int64

GetVersion returns the version of the ResetWorkflowTask

func (*ResetWorkflowTask) GetVisibilityTimestamp added in v0.5.8

func (a *ResetWorkflowTask) GetVisibilityTimestamp() time.Time

GetVisibilityTimestamp get the visibility timestamp

func (*ResetWorkflowTask) SetTaskID added in v0.5.8

func (a *ResetWorkflowTask) SetTaskID(id int64)

SetTaskID sets the sequence ID of the ResetWorkflowTask

func (*ResetWorkflowTask) SetVersion added in v0.5.8

func (a *ResetWorkflowTask) SetVersion(version int64)

SetVersion returns the version of the ResetWorkflowTask

func (*ResetWorkflowTask) SetVisibilityTimestamp added in v0.5.8

func (a *ResetWorkflowTask) SetVisibilityTimestamp(timestamp time.Time)

SetVisibilityTimestamp set the visibility timestamp

type ShardAlreadyExistError

type ShardAlreadyExistError struct {
	Msg string
}

ShardAlreadyExistError is returned when conditionally creating a shard fails

func (*ShardAlreadyExistError) Error

func (e *ShardAlreadyExistError) Error() string

type ShardInfo

type ShardInfo struct {
	ShardID                   int
	Owner                     string
	RangeID                   int64
	StolenSinceRenew          int
	UpdatedAt                 time.Time
	ReplicationAckLevel       int64
	TransferAckLevel          int64
	TimerAckLevel             time.Time
	ClusterTransferAckLevel   map[string]int64
	ClusterTimerAckLevel      map[string]time.Time
	TransferFailoverLevels    map[string]TransferFailoverLevel // uuid -> TransferFailoverLevel
	TimerFailoverLevels       map[string]TimerFailoverLevel    // uuid -> TimerFailoverLevel
	ClusterReplicationLevel   map[string]int64                 // cluster -> last replicated taskID
	DomainNotificationVersion int64
}

ShardInfo describes a shard

type ShardManager

type ShardManager interface {
	Closeable
	GetName() string
	CreateShard(request *CreateShardRequest) error
	GetShard(request *GetShardRequest) (*GetShardResponse, error)
	UpdateShard(request *UpdateShardRequest) error
}

ShardManager is used to manage all shards

func NewShardPersistenceMetricsClient added in v0.3.14

func NewShardPersistenceMetricsClient(persistence ShardManager, metricClient metrics.Client, logger log.Logger) ShardManager

NewShardPersistenceMetricsClient creates a client to manage shards

func NewShardPersistenceRateLimitedClient added in v0.3.14

func NewShardPersistenceRateLimitedClient(persistence ShardManager, rateLimiter quotas.Limiter, logger log.Logger) ShardManager

NewShardPersistenceRateLimitedClient creates a client to manage shards

type ShardOwnershipLostError

type ShardOwnershipLostError struct {
	ShardID int
	Msg     string
}

ShardOwnershipLostError is returned when conditional update fails due to RangeID for the shard

func (*ShardOwnershipLostError) Error

func (e *ShardOwnershipLostError) Error() string

type ShardStore added in v0.4.0

type ShardStore = ShardManager

ShardStore is a lower level of ShardManager

type SignalExecutionTask added in v0.3.6

type SignalExecutionTask struct {
	VisibilityTimestamp     time.Time
	TaskID                  int64
	TargetDomainID          string
	TargetWorkflowID        string
	TargetRunID             string
	TargetChildWorkflowOnly bool
	InitiatedID             int64
	Version                 int64
}

SignalExecutionTask identifies a transfer task for signal execution

func (*SignalExecutionTask) GetTaskID added in v0.3.6

func (u *SignalExecutionTask) GetTaskID() int64

GetTaskID returns the sequence ID of the signal transfer task.

func (*SignalExecutionTask) GetType added in v0.3.6

func (u *SignalExecutionTask) GetType() int

GetType returns the type of the signal transfer task

func (*SignalExecutionTask) GetVersion added in v0.3.12

func (u *SignalExecutionTask) GetVersion() int64

GetVersion returns the version of the signal transfer task

func (*SignalExecutionTask) GetVisibilityTimestamp added in v0.3.14

func (u *SignalExecutionTask) GetVisibilityTimestamp() time.Time

GetVisibilityTimestamp get the visibility timestamp

func (*SignalExecutionTask) SetTaskID added in v0.3.6

func (u *SignalExecutionTask) SetTaskID(id int64)

SetTaskID sets the sequence ID of the signal transfer task.

func (*SignalExecutionTask) SetVersion added in v0.3.12

func (u *SignalExecutionTask) SetVersion(version int64)

SetVersion returns the version of the signal transfer task

func (*SignalExecutionTask) SetVisibilityTimestamp added in v0.3.14

func (u *SignalExecutionTask) SetVisibilityTimestamp(timestamp time.Time)

SetVisibilityTimestamp set the visibility timestamp

type SignalInfo added in v0.3.6

type SignalInfo struct {
	Version               int64
	InitiatedEventBatchID int64
	InitiatedID           int64
	SignalRequestID       string
	SignalName            string
	Input                 []byte
	Control               []byte
}

SignalInfo has details for pending external workflow signal

type StartChildExecutionTask

type StartChildExecutionTask struct {
	VisibilityTimestamp time.Time
	TaskID              int64
	TargetDomainID      string
	TargetWorkflowID    string
	InitiatedID         int64
	Version             int64
}

StartChildExecutionTask identifies a transfer task for starting child execution

func (*StartChildExecutionTask) GetTaskID

func (u *StartChildExecutionTask) GetTaskID() int64

GetTaskID returns the sequence ID of the start child transfer task

func (*StartChildExecutionTask) GetType

func (u *StartChildExecutionTask) GetType() int

GetType returns the type of the start child transfer task

func (*StartChildExecutionTask) GetVersion added in v0.3.12

func (u *StartChildExecutionTask) GetVersion() int64

GetVersion returns the version of the start child transfer task

func (*StartChildExecutionTask) GetVisibilityTimestamp added in v0.3.14

func (u *StartChildExecutionTask) GetVisibilityTimestamp() time.Time

GetVisibilityTimestamp get the visibility timestamp

func (*StartChildExecutionTask) SetTaskID

func (u *StartChildExecutionTask) SetTaskID(id int64)

SetTaskID sets the sequence ID of the start child transfer task

func (*StartChildExecutionTask) SetVersion added in v0.3.12

func (u *StartChildExecutionTask) SetVersion(version int64)

SetVersion returns the version of the start child transfer task

func (*StartChildExecutionTask) SetVisibilityTimestamp added in v0.3.14

func (u *StartChildExecutionTask) SetVisibilityTimestamp(timestamp time.Time)

SetVisibilityTimestamp set the visibility timestamp

type SyncActivityTask added in v0.4.0

type SyncActivityTask struct {
	VisibilityTimestamp time.Time
	TaskID              int64
	Version             int64
	ScheduledID         int64
}

SyncActivityTask is the replication task created for shipping activity info to other clusters

func (*SyncActivityTask) GetTaskID added in v0.4.0

func (a *SyncActivityTask) GetTaskID() int64

GetTaskID returns the sequence ID of the history replication task

func (*SyncActivityTask) GetType added in v0.4.0

func (a *SyncActivityTask) GetType() int

GetType returns the type of the history replication task

func (*SyncActivityTask) GetVersion added in v0.4.0

func (a *SyncActivityTask) GetVersion() int64

GetVersion returns the version of the history replication task

func (*SyncActivityTask) GetVisibilityTimestamp added in v0.4.0

func (a *SyncActivityTask) GetVisibilityTimestamp() time.Time

GetVisibilityTimestamp get the visibility timestamp

func (*SyncActivityTask) SetTaskID added in v0.4.0

func (a *SyncActivityTask) SetTaskID(id int64)

SetTaskID sets the sequence ID of the history replication task

func (*SyncActivityTask) SetVersion added in v0.4.0

func (a *SyncActivityTask) SetVersion(version int64)

SetVersion returns the version of the history replication task

func (*SyncActivityTask) SetVisibilityTimestamp added in v0.4.0

func (a *SyncActivityTask) SetVisibilityTimestamp(timestamp time.Time)

SetVisibilityTimestamp set the visibility timestamp

type Task

type Task interface {
	GetType() int
	GetVersion() int64
	SetVersion(version int64)
	GetTaskID() int64
	SetTaskID(id int64)
	GetVisibilityTimestamp() time.Time
	SetVisibilityTimestamp(timestamp time.Time)
}

Task is the generic interface for workflow tasks

type TaskInfo

type TaskInfo struct {
	DomainID               string
	WorkflowID             string
	RunID                  string
	TaskID                 int64
	ScheduleID             int64
	ScheduleToStartTimeout int32
	Expiry                 time.Time
	CreatedTime            time.Time
}

TaskInfo describes either activity or decision task

type TaskListInfo

type TaskListInfo struct {
	DomainID    string
	Name        string
	TaskType    int
	RangeID     int64
	AckLevel    int64
	Kind        int
	Expiry      time.Time
	LastUpdated time.Time
}

TaskListInfo describes a state of a task list implementation.

type TaskManager

type TaskManager interface {
	Closeable
	GetName() string
	LeaseTaskList(request *LeaseTaskListRequest) (*LeaseTaskListResponse, error)
	UpdateTaskList(request *UpdateTaskListRequest) (*UpdateTaskListResponse, error)
	ListTaskList(request *ListTaskListRequest) (*ListTaskListResponse, error)
	DeleteTaskList(request *DeleteTaskListRequest) error
	CreateTasks(request *CreateTasksRequest) (*CreateTasksResponse, error)
	GetTasks(request *GetTasksRequest) (*GetTasksResponse, error)
	CompleteTask(request *CompleteTaskRequest) error
	// CompleteTasksLessThan completes tasks less than or equal to the given task id
	// This API takes a limit parameter which specifies the count of maxRows that
	// can be deleted. This parameter may be ignored by the underlying storage, but
	// its mandatory to specify it. On success this method returns the number of rows
	// actually deleted. If the underlying storage doesn't support "limit", all rows
	// less than or equal to taskID will be deleted.
	// On success, this method returns:
	//  - number of rows actually deleted, if limit is honored
	//  - UnknownNumRowsDeleted, when all rows below value are deleted
	CompleteTasksLessThan(request *CompleteTasksLessThanRequest) (int, error)
}

TaskManager is used to manage tasks

func NewTaskPersistenceMetricsClient added in v0.3.14

func NewTaskPersistenceMetricsClient(persistence TaskManager, metricClient metrics.Client, logger log.Logger) TaskManager

NewTaskPersistenceMetricsClient creates a client to manage tasks

func NewTaskPersistenceRateLimitedClient added in v0.3.14

func NewTaskPersistenceRateLimitedClient(persistence TaskManager, rateLimiter quotas.Limiter, logger log.Logger) TaskManager

NewTaskPersistenceRateLimitedClient creates a client to manage tasks

type TaskStore added in v0.4.0

type TaskStore = TaskManager

TaskStore is a lower level of TaskManager

type TimeoutError

type TimeoutError struct {
	Msg string
}

TimeoutError is returned when a write operation fails due to a timeout

func (*TimeoutError) Error

func (e *TimeoutError) Error() string

type TimerFailoverLevel added in v0.3.14

type TimerFailoverLevel struct {
	StartTime    time.Time
	MinLevel     time.Time
	CurrentLevel time.Time
	MaxLevel     time.Time
	DomainIDs    map[string]struct{}
}

TimerFailoverLevel contains domain IDs and corresponding start / end level

type TimerInfo

type TimerInfo struct {
	Version    int64
	TimerID    string
	StartedID  int64
	ExpiryTime time.Time
	TaskID     int64
}

TimerInfo details - metadata about user timer info.

type TimerTaskInfo

type TimerTaskInfo struct {
	DomainID            string
	WorkflowID          string
	RunID               string
	VisibilityTimestamp time.Time
	TaskID              int64
	TaskType            int
	TimeoutType         int
	EventID             int64
	ScheduleAttempt     int64
	Version             int64
}

TimerTaskInfo describes a timer task.

func (*TimerTaskInfo) GetDomainID added in v0.9.0

func (t *TimerTaskInfo) GetDomainID() string

GetDomainID returns the domain ID for timer task

func (*TimerTaskInfo) GetRunID added in v0.9.0

func (t *TimerTaskInfo) GetRunID() string

GetRunID returns the run ID for timer task

func (*TimerTaskInfo) GetTaskID added in v0.3.12

func (t *TimerTaskInfo) GetTaskID() int64

GetTaskID returns the task ID for timer task

func (*TimerTaskInfo) GetTaskType added in v0.3.12

func (t *TimerTaskInfo) GetTaskType() int

GetTaskType returns the task type for timer task

func (*TimerTaskInfo) GetVersion added in v0.3.12

func (t *TimerTaskInfo) GetVersion() int64

GetVersion returns the task version for timer task

func (*TimerTaskInfo) GetVisibilityTimestamp added in v0.3.14

func (t *TimerTaskInfo) GetVisibilityTimestamp() time.Time

GetVisibilityTimestamp returns the task type for timer task

func (*TimerTaskInfo) GetWorkflowID added in v0.9.0

func (t *TimerTaskInfo) GetWorkflowID() string

GetWorkflowID returns the workflow ID for timer task

func (*TimerTaskInfo) String added in v0.3.14

func (t *TimerTaskInfo) String() string

GetTaskType returns the task type for timer task

type TransactionSizeLimitError added in v0.5.9

type TransactionSizeLimitError struct {
	Msg string
}

TransactionSizeLimitError is returned when the transaction size is too large

func (*TransactionSizeLimitError) Error added in v0.5.9

func (e *TransactionSizeLimitError) Error() string

type TransferFailoverLevel added in v0.3.14

type TransferFailoverLevel struct {
	StartTime    time.Time
	MinLevel     int64
	CurrentLevel int64
	MaxLevel     int64
	DomainIDs    map[string]struct{}
}

TransferFailoverLevel contains corresponding start / end level

type TransferTaskInfo

type TransferTaskInfo struct {
	DomainID                string
	WorkflowID              string
	RunID                   string
	VisibilityTimestamp     time.Time
	TaskID                  int64
	TargetDomainID          string
	TargetWorkflowID        string
	TargetRunID             string
	TargetChildWorkflowOnly bool
	TaskList                string
	TaskType                int
	ScheduleID              int64
	Version                 int64
	RecordVisibility        bool
}

TransferTaskInfo describes a transfer task

func (*TransferTaskInfo) GetDomainID added in v0.9.0

func (t *TransferTaskInfo) GetDomainID() string

GetDomainID returns the domain ID for transfer task

func (*TransferTaskInfo) GetRunID added in v0.9.0

func (t *TransferTaskInfo) GetRunID() string

GetRunID returns the run ID for transfer task

func (*TransferTaskInfo) GetTaskID added in v0.3.11

func (t *TransferTaskInfo) GetTaskID() int64

GetTaskID returns the task ID for transfer task

func (*TransferTaskInfo) GetTaskType added in v0.3.11

func (t *TransferTaskInfo) GetTaskType() int

GetTaskType returns the task type for transfer task

func (*TransferTaskInfo) GetVersion added in v0.3.12

func (t *TransferTaskInfo) GetVersion() int64

GetVersion returns the task version for transfer task

func (*TransferTaskInfo) GetVisibilityTimestamp added in v0.3.14

func (t *TransferTaskInfo) GetVisibilityTimestamp() time.Time

GetVisibilityTimestamp returns the task type for transfer task

func (*TransferTaskInfo) GetWorkflowID added in v0.9.0

func (t *TransferTaskInfo) GetWorkflowID() string

GetWorkflowID returns the workflow ID for transfer task

func (*TransferTaskInfo) String added in v0.3.14

func (t *TransferTaskInfo) String() string

String returns string

type UnknownEncodingTypeError

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

UnknownEncodingTypeError is an error type for unknown or unsupported encoding type

func (*UnknownEncodingTypeError) Error

func (e *UnknownEncodingTypeError) Error() string

type UpdateDomainRequest

type UpdateDomainRequest struct {
	Info                        *DomainInfo
	Config                      *DomainConfig
	ReplicationConfig           *DomainReplicationConfig
	ConfigVersion               int64
	FailoverVersion             int64
	FailoverNotificationVersion int64
	NotificationVersion         int64
	TableVersion                int
}

UpdateDomainRequest is used to update domain

type UpdateShardRequest

type UpdateShardRequest struct {
	ShardInfo       *ShardInfo
	PreviousRangeID int64
}

UpdateShardRequest is used to update shard information

type UpdateTaskListRequest

type UpdateTaskListRequest struct {
	TaskListInfo *TaskListInfo
}

UpdateTaskListRequest is used to update task list implementation information

type UpdateTaskListResponse

type UpdateTaskListResponse struct {
}

UpdateTaskListResponse is the response to UpdateTaskList

type UpdateWorkflowExecutionRequest

type UpdateWorkflowExecutionRequest struct {
	RangeID int64

	UpdateWorkflowMutation WorkflowMutation

	NewWorkflowSnapshot *WorkflowSnapshot

	Encoding common.EncodingType // optional binary encoding type
}

UpdateWorkflowExecutionRequest is used to update a workflow execution

type UpdateWorkflowExecutionResponse added in v0.4.0

type UpdateWorkflowExecutionResponse struct {
	MutableStateUpdateSessionStats *MutableStateUpdateSessionStats
}

UpdateWorkflowExecutionResponse is response for UpdateWorkflowExecutionRequest

type UpsertWorkflowExecutionRequest added in v0.6.0

type UpsertWorkflowExecutionRequest struct {
	DomainUUID         string
	Domain             string // not persisted, used as config filter key
	Execution          s.WorkflowExecution
	WorkflowTypeName   string
	StartTimestamp     int64
	ExecutionTimestamp int64
	WorkflowTimeout    int64 // not persisted, used for cassandra ttl
	TaskID             int64 // not persisted, used as condition update version for ES
	Memo               *s.Memo
	SearchAttributes   map[string][]byte
}

UpsertWorkflowExecutionRequest is used to upsert workflow execution

type UpsertWorkflowSearchAttributesTask added in v0.6.0

type UpsertWorkflowSearchAttributesTask struct {
	VisibilityTimestamp time.Time
	TaskID              int64
	// this version is not used by task processing for validation,
	// instead, the version is used by elastic search
	Version int64
}

UpsertWorkflowSearchAttributesTask identifies a transfer task for upsert search attributes

func (*UpsertWorkflowSearchAttributesTask) GetTaskID added in v0.6.0

GetTaskID returns the sequence ID of the signal transfer task.

func (*UpsertWorkflowSearchAttributesTask) GetType added in v0.6.0

GetType returns the type of the upsert search attributes transfer task

func (*UpsertWorkflowSearchAttributesTask) GetVersion added in v0.6.0

func (u *UpsertWorkflowSearchAttributesTask) GetVersion() int64

GetVersion returns the version of the upsert search attributes transfer task

func (*UpsertWorkflowSearchAttributesTask) GetVisibilityTimestamp added in v0.6.0

func (u *UpsertWorkflowSearchAttributesTask) GetVisibilityTimestamp() time.Time

GetVisibilityTimestamp get the visibility timestamp

func (*UpsertWorkflowSearchAttributesTask) SetTaskID added in v0.6.0

func (u *UpsertWorkflowSearchAttributesTask) SetTaskID(id int64)

SetTaskID sets the sequence ID of the signal transfer task.

func (*UpsertWorkflowSearchAttributesTask) SetVersion added in v0.6.0

func (u *UpsertWorkflowSearchAttributesTask) SetVersion(version int64)

SetVersion returns the version of the upsert search attributes transfer task

func (*UpsertWorkflowSearchAttributesTask) SetVisibilityTimestamp added in v0.6.0

func (u *UpsertWorkflowSearchAttributesTask) SetVisibilityTimestamp(timestamp time.Time)

SetVisibilityTimestamp set the visibility timestamp

type UserTimerTask

type UserTimerTask struct {
	VisibilityTimestamp time.Time
	TaskID              int64
	EventID             int64
	Version             int64
}

UserTimerTask identifies a timeout task.

func (*UserTimerTask) GetTaskID

func (u *UserTimerTask) GetTaskID() int64

GetTaskID returns the sequence ID of the timer task.

func (*UserTimerTask) GetType

func (u *UserTimerTask) GetType() int

GetType returns the type of the timer task

func (*UserTimerTask) GetVersion added in v0.3.12

func (u *UserTimerTask) GetVersion() int64

GetVersion returns the version of the timer task

func (*UserTimerTask) GetVisibilityTimestamp

func (u *UserTimerTask) GetVisibilityTimestamp() time.Time

GetVisibilityTimestamp gets the visibility time stamp

func (*UserTimerTask) SetTaskID

func (u *UserTimerTask) SetTaskID(id int64)

SetTaskID sets the sequence ID of the timer task.

func (*UserTimerTask) SetVersion added in v0.3.12

func (u *UserTimerTask) SetVersion(version int64)

SetVersion returns the version of the timer task

func (*UserTimerTask) SetVisibilityTimestamp

func (u *UserTimerTask) SetVisibilityTimestamp(t time.Time)

SetVisibilityTimestamp gets the visibility time stamp

type VersionHistories added in v0.5.8

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

VersionHistories contains a set of VersionHistory

func NewVersionHistories added in v0.5.8

func NewVersionHistories(histories []VersionHistory) VersionHistories

NewVersionHistories initialize new version histories

func (*VersionHistories) AddHistory added in v0.5.8

func (h *VersionHistories) AddHistory(item VersionHistoryItem, local VersionHistory, remote VersionHistory) error

AddHistory add new history into version histories TODO: merge this func with FindLowestCommonVersionHistory

func (*VersionHistories) FindLowestCommonVersionHistory added in v0.5.8

func (h *VersionHistories) FindLowestCommonVersionHistory(history VersionHistory) (VersionHistoryItem, VersionHistory, error)

FindLowestCommonVersionHistory finds the lowest common version history item among all version histories

func (*VersionHistories) GetHistories added in v0.5.8

func (h *VersionHistories) GetHistories() []VersionHistory

GetHistories returns the batch histories

type VersionHistory added in v0.5.8

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

VersionHistory provides operations on version history

func NewVersionHistory added in v0.5.8

func NewVersionHistory(items []VersionHistoryItem) VersionHistory

NewVersionHistory initializes new version history

func (*VersionHistory) FindLowestCommonVersionHistoryItem added in v0.5.8

func (v *VersionHistory) FindLowestCommonVersionHistoryItem(remote VersionHistory) (VersionHistoryItem, error)

FindLowestCommonVersionHistoryItem returns the lowest version history item with the same version

func (*VersionHistory) IsAppendable added in v0.5.8

func (v *VersionHistory) IsAppendable(item VersionHistoryItem) bool

IsAppendable checks if a version history item is appendable

func (*VersionHistory) Update added in v0.5.8

func (v *VersionHistory) Update(item VersionHistoryItem) error

Update updates the versionHistory slice

type VersionHistoryItem added in v0.5.8

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

VersionHistoryItem contains the event id and the associated version

type VisibilityDeleteWorkflowExecutionRequest added in v0.5.7

type VisibilityDeleteWorkflowExecutionRequest struct {
	DomainID   string
	RunID      string
	WorkflowID string
	TaskID     int64
}

VisibilityDeleteWorkflowExecutionRequest contains the request params for DeleteWorkflowExecution call

type VisibilityManager

type VisibilityManager interface {
	Closeable
	GetName() string
	RecordWorkflowExecutionStarted(request *RecordWorkflowExecutionStartedRequest) error
	RecordWorkflowExecutionClosed(request *RecordWorkflowExecutionClosedRequest) error
	UpsertWorkflowExecution(request *UpsertWorkflowExecutionRequest) error
	ListOpenWorkflowExecutions(request *ListWorkflowExecutionsRequest) (*ListWorkflowExecutionsResponse, error)
	ListClosedWorkflowExecutions(request *ListWorkflowExecutionsRequest) (*ListWorkflowExecutionsResponse, error)
	ListOpenWorkflowExecutionsByType(request *ListWorkflowExecutionsByTypeRequest) (*ListWorkflowExecutionsResponse, error)
	ListClosedWorkflowExecutionsByType(request *ListWorkflowExecutionsByTypeRequest) (*ListWorkflowExecutionsResponse, error)
	ListOpenWorkflowExecutionsByWorkflowID(request *ListWorkflowExecutionsByWorkflowIDRequest) (*ListWorkflowExecutionsResponse, error)
	ListClosedWorkflowExecutionsByWorkflowID(request *ListWorkflowExecutionsByWorkflowIDRequest) (*ListWorkflowExecutionsResponse, error)
	ListClosedWorkflowExecutionsByStatus(request *ListClosedWorkflowExecutionsByStatusRequest) (*ListWorkflowExecutionsResponse, error)
	GetClosedWorkflowExecution(request *GetClosedWorkflowExecutionRequest) (*GetClosedWorkflowExecutionResponse, error)
	DeleteWorkflowExecution(request *VisibilityDeleteWorkflowExecutionRequest) error
	ListWorkflowExecutions(request *ListWorkflowExecutionsRequestV2) (*ListWorkflowExecutionsResponse, error)
	ScanWorkflowExecutions(request *ListWorkflowExecutionsRequestV2) (*ListWorkflowExecutionsResponse, error)
	CountWorkflowExecutions(request *CountWorkflowExecutionsRequest) (*CountWorkflowExecutionsResponse, error)
}

VisibilityManager is used to manage the visibility store

func NewVisibilityManagerImpl added in v0.5.7

func NewVisibilityManagerImpl(persistence VisibilityStore, logger log.Logger) VisibilityManager

NewVisibilityManagerImpl returns new VisibilityManager

func NewVisibilityManagerWrapper added in v0.5.2

func NewVisibilityManagerWrapper(visibilityManager, esVisibilityManager VisibilityManager,
	enableReadVisibilityFromES dynamicconfig.BoolPropertyFnWithDomainFilter,
	advancedVisWritingMode dynamicconfig.StringPropertyFn) VisibilityManager

NewVisibilityManagerWrapper create a visibility manager that operate on DB or ElasticSearch based on dynamic config.

func NewVisibilityPersistenceMetricsClient added in v0.3.14

func NewVisibilityPersistenceMetricsClient(persistence VisibilityManager, metricClient metrics.Client, logger log.Logger) VisibilityManager

NewVisibilityPersistenceMetricsClient creates a client to manage visibility

func NewVisibilityPersistenceRateLimitedClient added in v0.3.14

func NewVisibilityPersistenceRateLimitedClient(persistence VisibilityManager, rateLimiter quotas.Limiter, logger log.Logger) VisibilityManager

NewVisibilityPersistenceRateLimitedClient creates a client to manage visibility

func NewVisibilitySamplingClient added in v0.5.0

func NewVisibilitySamplingClient(persistence VisibilityManager, config *config.VisibilityConfig, metricClient metrics.Client, logger log.Logger) VisibilityManager

NewVisibilitySamplingClient creates a client to manage visibility with sampling

type VisibilityStore added in v0.4.0

type VisibilityStore interface {
	Closeable
	GetName() string
	RecordWorkflowExecutionStarted(request *InternalRecordWorkflowExecutionStartedRequest) error
	RecordWorkflowExecutionClosed(request *InternalRecordWorkflowExecutionClosedRequest) error
	UpsertWorkflowExecution(request *InternalUpsertWorkflowExecutionRequest) error
	ListOpenWorkflowExecutions(request *ListWorkflowExecutionsRequest) (*InternalListWorkflowExecutionsResponse, error)
	ListClosedWorkflowExecutions(request *ListWorkflowExecutionsRequest) (*InternalListWorkflowExecutionsResponse, error)
	ListOpenWorkflowExecutionsByType(request *ListWorkflowExecutionsByTypeRequest) (*InternalListWorkflowExecutionsResponse, error)
	ListClosedWorkflowExecutionsByType(request *ListWorkflowExecutionsByTypeRequest) (*InternalListWorkflowExecutionsResponse, error)
	ListOpenWorkflowExecutionsByWorkflowID(request *ListWorkflowExecutionsByWorkflowIDRequest) (*InternalListWorkflowExecutionsResponse, error)
	ListClosedWorkflowExecutionsByWorkflowID(request *ListWorkflowExecutionsByWorkflowIDRequest) (*InternalListWorkflowExecutionsResponse, error)
	ListClosedWorkflowExecutionsByStatus(request *ListClosedWorkflowExecutionsByStatusRequest) (*InternalListWorkflowExecutionsResponse, error)
	GetClosedWorkflowExecution(request *GetClosedWorkflowExecutionRequest) (*InternalGetClosedWorkflowExecutionResponse, error)
	DeleteWorkflowExecution(request *VisibilityDeleteWorkflowExecutionRequest) error
	ListWorkflowExecutions(request *ListWorkflowExecutionsRequestV2) (*InternalListWorkflowExecutionsResponse, error)
	ScanWorkflowExecutions(request *ListWorkflowExecutionsRequestV2) (*InternalListWorkflowExecutionsResponse, error)
	CountWorkflowExecutions(request *CountWorkflowExecutionsRequest) (*CountWorkflowExecutionsResponse, error)
}

VisibilityStore is the store interface for visibility

type VisibilityWorkflowExecutionInfo added in v0.5.7

type VisibilityWorkflowExecutionInfo struct {
	WorkflowID       string
	RunID            string
	TypeName         string
	StartTime        time.Time
	ExecutionTime    time.Time
	CloseTime        time.Time
	Status           *workflow.WorkflowExecutionCloseStatus
	HistoryLength    int64
	Memo             *DataBlob
	SearchAttributes map[string]interface{}
}

VisibilityWorkflowExecutionInfo is visibility info for internal response

type WorkflowBackoffTimerTask added in v0.5.0

type WorkflowBackoffTimerTask struct {
	VisibilityTimestamp time.Time
	TaskID              int64
	EventID             int64 // TODO this attribute is not used?
	Version             int64
	TimeoutType         int // 0 for retry, 1 for cron.
}

WorkflowBackoffTimerTask to schedule first decision task for retried workflow

func (*WorkflowBackoffTimerTask) GetTaskID added in v0.5.0

func (r *WorkflowBackoffTimerTask) GetTaskID() int64

GetTaskID returns the sequence ID.

func (*WorkflowBackoffTimerTask) GetType added in v0.5.0

func (r *WorkflowBackoffTimerTask) GetType() int

GetType returns the type of the retry timer task

func (*WorkflowBackoffTimerTask) GetVersion added in v0.5.0

func (r *WorkflowBackoffTimerTask) GetVersion() int64

GetVersion returns the version of the retry timer task

func (*WorkflowBackoffTimerTask) GetVisibilityTimestamp added in v0.5.0

func (r *WorkflowBackoffTimerTask) GetVisibilityTimestamp() time.Time

GetVisibilityTimestamp gets the visibility time stamp

func (*WorkflowBackoffTimerTask) SetTaskID added in v0.5.0

func (r *WorkflowBackoffTimerTask) SetTaskID(id int64)

SetTaskID sets the sequence ID.

func (*WorkflowBackoffTimerTask) SetVersion added in v0.5.0

func (r *WorkflowBackoffTimerTask) SetVersion(version int64)

SetVersion returns the version of the retry timer task

func (*WorkflowBackoffTimerTask) SetVisibilityTimestamp added in v0.5.0

func (r *WorkflowBackoffTimerTask) SetVisibilityTimestamp(t time.Time)

SetVisibilityTimestamp gets the visibility time stamp

type WorkflowEvents added in v0.7.0

type WorkflowEvents struct {
	DomainID    string
	WorkflowID  string
	RunID       string
	BranchToken []byte
	Events      []*workflow.HistoryEvent
}

WorkflowEvents is used as generic workflow history events transaction container

type WorkflowExecutionAlreadyStartedError added in v0.3.5

type WorkflowExecutionAlreadyStartedError struct {
	Msg              string
	StartRequestID   string
	RunID            string
	State            int
	CloseStatus      int
	LastWriteVersion int64
}

WorkflowExecutionAlreadyStartedError is returned when creating a new workflow failed.

func (*WorkflowExecutionAlreadyStartedError) Error added in v0.3.5

type WorkflowExecutionInfo

type WorkflowExecutionInfo struct {
	DomainID                           string
	WorkflowID                         string
	RunID                              string
	ParentDomainID                     string
	ParentWorkflowID                   string
	ParentRunID                        string
	InitiatedID                        int64
	CompletionEventBatchID             int64
	CompletionEvent                    *workflow.HistoryEvent
	TaskList                           string
	WorkflowTypeName                   string
	WorkflowTimeout                    int32
	DecisionTimeoutValue               int32
	ExecutionContext                   []byte
	State                              int
	CloseStatus                        int
	LastFirstEventID                   int64
	LastEventTaskID                    int64
	NextEventID                        int64
	LastProcessedEvent                 int64
	StartTimestamp                     time.Time
	LastUpdatedTimestamp               time.Time
	CreateRequestID                    string
	SignalCount                        int32
	DecisionVersion                    int64
	DecisionScheduleID                 int64
	DecisionStartedID                  int64
	DecisionRequestID                  string
	DecisionTimeout                    int32
	DecisionAttempt                    int64
	DecisionStartedTimestamp           int64
	DecisionScheduledTimestamp         int64
	DecisionOriginalScheduledTimestamp int64
	CancelRequested                    bool
	CancelRequestID                    string
	StickyTaskList                     string
	StickyScheduleToStartTimeout       int32
	ClientLibraryVersion               string
	ClientFeatureVersion               string
	ClientImpl                         string
	AutoResetPoints                    *workflow.ResetPoints
	Memo                               map[string][]byte
	SearchAttributes                   map[string][]byte
	// for retry
	Attempt            int32
	HasRetryPolicy     bool
	InitialInterval    int32
	BackoffCoefficient float64
	MaximumInterval    int32
	ExpirationTime     time.Time
	MaximumAttempts    int32
	NonRetriableErrors []string
	// events V2 related
	EventStoreVersion int32
	BranchToken       []byte
	// Cron
	CronSchedule      string
	ExpirationSeconds int32
}

WorkflowExecutionInfo describes a workflow execution

func (*WorkflowExecutionInfo) GetCurrentBranch added in v0.5.0

func (e *WorkflowExecutionInfo) GetCurrentBranch() []byte

GetCurrentBranch return the current branch token

func (*WorkflowExecutionInfo) IncreaseNextEventID added in v0.5.0

func (e *WorkflowExecutionInfo) IncreaseNextEventID()

IncreaseNextEventID increase the nextEventID by 1

func (*WorkflowExecutionInfo) SetLastFirstEventID added in v0.5.0

func (e *WorkflowExecutionInfo) SetLastFirstEventID(id int64)

SetLastFirstEventID set the LastFirstEventID

func (*WorkflowExecutionInfo) SetNextEventID added in v0.5.0

func (e *WorkflowExecutionInfo) SetNextEventID(id int64)

SetNextEventID sets the nextEventID

type WorkflowMutableState

type WorkflowMutableState struct {
	ActivityInfos       map[int64]*ActivityInfo
	TimerInfos          map[string]*TimerInfo
	ChildExecutionInfos map[int64]*ChildExecutionInfo
	RequestCancelInfos  map[int64]*RequestCancelInfo
	SignalInfos         map[int64]*SignalInfo
	SignalRequestedIDs  map[string]struct{}
	ExecutionInfo       *WorkflowExecutionInfo
	ExecutionStats      *ExecutionStats
	ReplicationState    *ReplicationState
	BufferedEvents      []*workflow.HistoryEvent
}

WorkflowMutableState indicates workflow related state

type WorkflowMutation added in v0.6.0

type WorkflowMutation struct {
	ExecutionInfo    *WorkflowExecutionInfo
	ExecutionStats   *ExecutionStats
	ReplicationState *ReplicationState

	UpsertActivityInfos       []*ActivityInfo
	DeleteActivityInfos       []int64
	UpserTimerInfos           []*TimerInfo
	DeleteTimerInfos          []string
	UpsertChildExecutionInfos []*ChildExecutionInfo
	DeleteChildExecutionInfo  *int64
	UpsertRequestCancelInfos  []*RequestCancelInfo
	DeleteRequestCancelInfo   *int64
	UpsertSignalInfos         []*SignalInfo
	DeleteSignalInfo          *int64
	UpsertSignalRequestedIDs  []string
	DeleteSignalRequestedID   string
	NewBufferedEvents         []*workflow.HistoryEvent
	ClearBufferedEvents       bool

	TransferTasks    []Task
	ReplicationTasks []Task
	TimerTasks       []Task

	Condition int64
}

WorkflowMutation is used as generic workflow execution state mutation

type WorkflowSnapshot added in v0.6.0

type WorkflowSnapshot struct {
	ExecutionInfo    *WorkflowExecutionInfo
	ExecutionStats   *ExecutionStats
	ReplicationState *ReplicationState

	ActivityInfos       []*ActivityInfo
	TimerInfos          []*TimerInfo
	ChildExecutionInfos []*ChildExecutionInfo
	RequestCancelInfos  []*RequestCancelInfo
	SignalInfos         []*SignalInfo
	SignalRequestedIDs  []string

	TransferTasks    []Task
	ReplicationTasks []Task
	TimerTasks       []Task

	Condition int64
}

WorkflowSnapshot is used as generic workflow execution state snapshot

type WorkflowTimeoutTask

type WorkflowTimeoutTask struct {
	VisibilityTimestamp time.Time
	TaskID              int64
	Version             int64
}

WorkflowTimeoutTask identifies a timeout task.

func (*WorkflowTimeoutTask) GetTaskID

func (u *WorkflowTimeoutTask) GetTaskID() int64

GetTaskID returns the sequence ID of the cancel transfer task.

func (*WorkflowTimeoutTask) GetType

func (u *WorkflowTimeoutTask) GetType() int

GetType returns the type of the timeout task.

func (*WorkflowTimeoutTask) GetVersion added in v0.3.12

func (u *WorkflowTimeoutTask) GetVersion() int64

GetVersion returns the version of the timeout task

func (*WorkflowTimeoutTask) GetVisibilityTimestamp

func (u *WorkflowTimeoutTask) GetVisibilityTimestamp() time.Time

GetVisibilityTimestamp gets the visibility time stamp

func (*WorkflowTimeoutTask) SetTaskID

func (u *WorkflowTimeoutTask) SetTaskID(id int64)

SetTaskID sets the sequence ID of the cancel transfer task.

func (*WorkflowTimeoutTask) SetVersion added in v0.3.12

func (u *WorkflowTimeoutTask) SetVersion(version int64)

SetVersion returns the version of the timeout task

func (*WorkflowTimeoutTask) SetVisibilityTimestamp

func (u *WorkflowTimeoutTask) SetVisibilityTimestamp(t time.Time)

SetVisibilityTimestamp gets the visibility time stamp

Jump to

Keyboard shortcuts

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