persistence

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2021 License: MIT Imports: 39 Imported by: 7

Documentation

Overview

Package persistence is a generated GoMock package.

Index

Constants

View Source
const (
	// InitialFailoverNotificationVersion is the initial failover version for a namespace
	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"
)
View Source
const (
	// EventStoreVersion is already deprecated, this is used for forward
	// compatibility (so that rollback is possible).
	// TODO we can remove it after fixing all the query templates and when
	// we decide the compatibility is no longer needed.
	EventStoreVersion = 2
)
View Source
const UnknownNumRowsAffected = -1

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

View Source
const VisibilityEncoding = enumspb.ENCODING_TYPE_PROTO3

VisibilityEncoding is default encoding for visibility data

Variables

View Source
var (
	// ErrInvalidMembershipExpiry is used when upserting new cluster membership with an invalid duration
	ErrInvalidMembershipExpiry = errors.New("membershipExpiry duration should be atleast 1 second")

	// ErrIncompleteMembershipUpsert is used when upserting new cluster membership with missing fields
	ErrIncompleteMembershipUpsert = errors.New("membership upserts require all fields")
)
View Source
var (
	// ErrPersistenceLimitExceeded is the error indicating QPS limit reached.
	ErrPersistenceLimitExceeded = serviceerror.NewResourceExhausted("Persistence Max QPS Reached.")
	// ErrPersistenceLimitExceededForList is the error indicating QPS limit reached for list visibility.
	ErrPersistenceLimitExceededForList = serviceerror.NewResourceExhausted("Persistence Max QPS Reached for List Operations.")
)

Functions

func ApplyWorkflowExecutionWritePolicies added in v0.30.0

func ApplyWorkflowExecutionWritePolicies(info *persistenceblobs.WorkflowExecutionInfo, startVersion int64, versionHistories *history.VersionHistories)

func BuildHistoryGarbageCleanupInfo added in v0.27.0

func BuildHistoryGarbageCleanupInfo(namespaceID, workflowID, runID string) string

BuildHistoryGarbageCleanupInfo combine the workflow identity information into a string

func DBTimestampToUnixNano added in v0.4.0

func DBTimestampToUnixNano(milliseconds int64) int64

DBTimestampToUnixNano converts CQL timestamp to UnixNano

func FromDataBlob added in v0.4.0

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

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

func GetBeginNodeID added in v0.5.7

func GetBeginNodeID(bi *persistenceblobs.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 GetOrUseDefaultClusters added in v0.3.7

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

GetOrUseDefaultClusters return the current cluster or use the input if valid

func IsNopUpsertWorkflowRequest added in v0.27.0

func IsNopUpsertWorkflowRequest(request *InternalUpsertWorkflowExecutionRequest) bool

IsNopUpsertWorkflowRequest return whether upsert request should be no-op

func IsTimeoutError added in v0.5.7

func IsTimeoutError(err error) bool

IsTimeoutError check whether error is TimeoutError

func NewDataBlob added in v0.4.0

func NewDataBlob(data []byte, encodingTypeStr string) *serialization.DataBlob

NewDataBlob returns a new DataBlob

func NewDataBlobFromProto added in v0.27.0

func NewDataBlobFromProto(blob *commonpb.DataBlob) *serialization.DataBlob

NewDataBlobFromProto convert data blob from Proto representation

func NewHistoryBranchToken added in v0.5.0

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

NewHistoryBranchToken return a new branch token

func NewHistoryBranchTokenByBranchID added in v0.27.0

func NewHistoryBranchTokenByBranchID(treeID, branchID string) ([]byte, error)

NewHistoryBranchTokenByBranchID return a new branch token with treeID/branchID

func NewOperationNotSupportErrorForVis added in v0.5.7

func NewOperationNotSupportErrorForVis() error

NewOperationNotSupportErrorForVis create error for operation not support in visibility

func NewUnknownEncodingTypeError

func NewUnknownEncodingTypeError(encodingType enumspb.EncodingType) error

NewUnknownEncodingTypeError returns a new instance of encoding type error

func ReadFullPageV2Events added in v0.5.3

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

ReadFullPageV2Events reads a full page of history events from HistoryManager. 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 HistoryManager, req *ReadHistoryBranchRequest) ([]*historypb.History, int, []byte, error)

ReadFullPageV2EventsByBatch reads a full page of history events by batch from HistoryManager. 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 SplitHistoryGarbageCleanupInfo added in v0.27.0

func SplitHistoryGarbageCleanupInfo(info string) (namespaceID, workflowID, runID string, err error)

SplitHistoryGarbageCleanupInfo returns workflow identity information

func UnixNanoToDBTimestamp added in v0.4.0

func UnixNanoToDBTimestamp(timestamp int64) int64

UnixNanoToDBTimestamp converts UnixNano to CQL timestamp

func ValidateConflictResolveWorkflowModeState added in v0.27.0

func ValidateConflictResolveWorkflowModeState(
	mode ConflictResolveWorkflowMode,
	resetWorkflowSnapshot InternalWorkflowSnapshot,
	newWorkflowSnapshot *InternalWorkflowSnapshot,
	currentWorkflowMutation *InternalWorkflowMutation,
) error

ValidateConflictResolveWorkflowModeState validate workflow conflict resolve mode & workflow state

func ValidateCreateWorkflowModeState added in v0.27.0

func ValidateCreateWorkflowModeState(
	mode CreateWorkflowMode,
	newWorkflowSnapshot InternalWorkflowSnapshot,
) error

ValidateCreateWorkflowModeState validate workflow creation mode & workflow state

func ValidateCreateWorkflowStateStatus added in v0.27.0

func ValidateCreateWorkflowStateStatus(
	state enumsspb.WorkflowExecutionState,
	status enumspb.WorkflowExecutionStatus,
) error

ValidateCreateWorkflowStateStatus validate workflow state and close status

func ValidateUpdateWorkflowModeState added in v0.27.0

func ValidateUpdateWorkflowModeState(
	mode UpdateWorkflowMode,
	currentWorkflowMutation InternalWorkflowMutation,
	newWorkflowSnapshot *InternalWorkflowSnapshot,
) error

ValidateUpdateWorkflowModeState validate workflow update mode & workflow state

func ValidateUpdateWorkflowStateStatus added in v0.27.0

func ValidateUpdateWorkflowStateStatus(
	state enumsspb.WorkflowExecutionState,
	status enumspb.WorkflowExecutionStatus,
) error

ValidateUpdateWorkflowStateStatus validate workflow state and status

func WorkflowExecutionToProto added in v0.30.0

func WorkflowExecutionToProto(executionInfo *WorkflowExecutionInfo, startVersion int64, versionHistories *history.VersionHistories) (*persistenceblobs.WorkflowExecutionInfo, *persistenceblobs.WorkflowExecutionState, error)

Types

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

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

GetVisibilityTime 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
	NamespaceID         string
	TaskQueue           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() enumsspb.TaskType

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

GetVisibilityTime 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         enumspb.TimeoutType
	EventID             int64
	Attempt             int32
	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() enumsspb.TaskType

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

GetVisibilityTime 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 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 []*historypb.HistoryEvent
	// requested TransactionID for this write operation. For the same eventID, the node with larger TransactionID always wins
	TransactionID int64
	// 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 CancelExecutionTask

type CancelExecutionTask struct {
	VisibilityTimestamp     time.Time
	TaskID                  int64
	TargetNamespaceID       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() enumsspb.TaskType

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

GetVisibilityTime 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 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() enumsspb.TaskType

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

GetVisibilityTime 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 ClusterMember added in v0.27.0

type ClusterMember struct {
	Role          ServiceType
	HostID        uuid.UUID
	RPCAddress    net.IP
	RPCPort       uint16
	SessionStart  time.Time
	LastHeartbeat time.Time
	RecordExpiry  time.Time
}

ClusterMember is used as a response to GetClusterMembers

type ClusterMetadataManager added in v0.27.0

type ClusterMetadataManager interface {
	Closeable
	GetName() string
	InitializeImmutableClusterMetadata(request *InitializeImmutableClusterMetadataRequest) (*InitializeImmutableClusterMetadataResponse, error)
	GetImmutableClusterMetadata() (*GetImmutableClusterMetadataResponse, error)
	GetClusterMembers(request *GetClusterMembersRequest) (*GetClusterMembersResponse, error)
	UpsertClusterMembership(request *UpsertClusterMembershipRequest) error
	PruneClusterMembership(request *PruneClusterMembershipRequest) error
}

ClusterMetadataManager is used to manage cluster-wide metadata and configuration

func NewClusterMetadataManagerImpl added in v0.27.0

func NewClusterMetadataManagerImpl(persistence ClusterMetadataStore, logger log.Logger) ClusterMetadataManager

NewClusterMetadataManagerImpl returns new ClusterMetadataManager

func NewClusterMetadataPersistenceMetricsClient added in v0.27.0

func NewClusterMetadataPersistenceMetricsClient(persistence ClusterMetadataManager, metricClient metrics.Client, logger log.Logger) ClusterMetadataManager

NewClusterMetadataPersistenceMetricsClient creates a ClusterMetadataManager client to manage cluster metadata

func NewClusterMetadataPersistenceRateLimitedClient added in v0.27.0

func NewClusterMetadataPersistenceRateLimitedClient(persistence ClusterMetadataManager, rateLimiter quotas.Limiter, logger log.Logger) ClusterMetadataManager

NewClusterMetadataPersistenceRateLimitedClient creates a MetadataManager client to manage metadata

type ClusterMetadataStore added in v0.27.0

type ClusterMetadataStore interface {
	Closeable
	GetName() string
	// Initialize immutable metadata for the cluster. Takes no action if already initialized.
	InitializeImmutableClusterMetadata(request *InternalInitializeImmutableClusterMetadataRequest) (*InternalInitializeImmutableClusterMetadataResponse, error)
	GetImmutableClusterMetadata() (*InternalGetImmutableClusterMetadataResponse, error)
	// Membership APIs
	GetClusterMembers(request *GetClusterMembersRequest) (*GetClusterMembersResponse, error)
	UpsertClusterMembership(request *UpsertClusterMembershipRequest) error
	PruneClusterMembership(request *PruneClusterMembershipRequest) error
}

ClusterMetadataStore is a lower level of ClusterMetadataManager. There is no Internal constructs needed to abstract away at the interface level currently,

so we can reimplement the ClusterMetadataManager and leave this as a placeholder.

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 {
	TaskQueue *TaskQueueKey
	TaskID    int64
}

CompleteTaskRequest is used to complete a task

type CompleteTasksLessThanRequest added in v0.5.4

type CompleteTasksLessThanRequest struct {
	NamespaceID   string
	TaskQueueName string
	TaskType      enumspb.TaskQueueType
	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

	Mode ConflictResolveWorkflowMode

	// workflow to be resetted
	ResetWorkflowSnapshot WorkflowSnapshot

	// maybe new workflow
	NewWorkflowSnapshot *WorkflowSnapshot

	// current workflow
	CurrentWorkflowMutation *WorkflowMutation
}

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

type ConflictResolveWorkflowMode added in v0.27.0

type ConflictResolveWorkflowMode int

ConflictResolveWorkflowMode conflict resolve mode

const (
	// Conflict resolve workflow, including current record
	// NOTE: update on current record is a condition update
	ConflictResolveWorkflowModeUpdateCurrent ConflictResolveWorkflowMode = iota
	// Conflict resolve workflow, without current record
	// NOTE: current record CANNOT point to the workflow to be updated
	ConflictResolveWorkflowModeBypassCurrent
)

Conflict Resolve Workflow Mode

type CountWorkflowExecutionsRequest added in v0.5.8

type CountWorkflowExecutionsRequest struct {
	NamespaceID string
	Namespace   string // namespace 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 CreateNamespaceRequest added in v0.27.0

type CreateNamespaceRequest struct {
	Namespace         *persistenceblobs.NamespaceDetail
	IsGlobalNamespace bool
}

CreateNamespaceRequest is used to create the namespace

type CreateNamespaceResponse added in v0.27.0

type CreateNamespaceResponse struct {
	ID string
}

CreateNamespaceResponse is the response for CreateNamespace

type CreateShardRequest

type CreateShardRequest struct {
	ShardInfo *persistenceblobs.ShardInfo
}

CreateShardRequest is used to create a shard in executions table

type CreateTasksRequest

type CreateTasksRequest struct {
	TaskQueueInfo *PersistedTaskQueueInfo
	Tasks         []*persistenceblobs.AllocatedTaskInfo
}

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

type CreateTasksResponse

type CreateTasksResponse struct {
}

CreateTasksResponse is the response to CreateTasksRequest

type CreateWorkflowExecutionRequest

type CreateWorkflowExecutionRequest struct {
	RangeID int64

	Mode CreateWorkflowMode

	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 CreateWorkflowMode added in v0.27.0

type CreateWorkflowMode int

CreateWorkflowMode workflow creation mode

const (
	// Fail if current record exists
	// Only applicable for CreateWorkflowExecution
	CreateWorkflowModeBrandNew CreateWorkflowMode = 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
	// Do not update current record since workflow to
	// applicable for CreateWorkflowExecution, UpdateWorkflowExecution
	CreateWorkflowModeZombie
)

Create Workflow Execution Mode

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 DeleteCurrentWorkflowExecutionRequest added in v0.5.8

type DeleteCurrentWorkflowExecutionRequest struct {
	NamespaceID string
	WorkflowID  string
	RunID       string
}

DeleteCurrentWorkflowExecutionRequest is used to delete the current workflow execution

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

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

GetVisibilityTime 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 DeleteNamespaceByNameRequest added in v0.27.0

type DeleteNamespaceByNameRequest struct {
	Name string
}

DeleteNamespaceByNameRequest is used to delete namespace entry from namespaces_by_name table

type DeleteNamespaceRequest added in v0.27.0

type DeleteNamespaceRequest struct {
	ID string
}

DeleteNamespaceRequest is used to delete namespace entry from namespaces table

type DeleteReplicationTaskFromDLQRequest added in v0.27.0

type DeleteReplicationTaskFromDLQRequest struct {
	SourceClusterName string
	TaskID            int64
}

DeleteReplicationTaskFromDLQRequest is used to delete replication task from DLQ

type DeleteTaskQueueRequest added in v0.27.0

type DeleteTaskQueueRequest struct {
	TaskQueue *TaskQueueKey
	RangeID   int64
}

DeleteTaskQueueRequest contains the request params needed to invoke DeleteTaskQueue API

type DeleteWorkflowExecutionRequest

type DeleteWorkflowExecutionRequest struct {
	NamespaceID string
	WorkflowID  string
	RunID       string
}

DeleteWorkflowExecutionRequest is used to delete a workflow execution

type DeserializationError added in v0.27.0

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

DeserializationError is an error type for deserialization

func NewDeserializationError added in v0.27.0

func NewDeserializationError(msg string) *DeserializationError

NewDeserializationError returns a DeserializationError

func (*DeserializationError) Error added in v0.27.0

func (e *DeserializationError) Error() string

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
	GetTransferTask(request *GetTransferTaskRequest) (*GetTransferTaskResponse, error)
	GetTransferTasks(request *GetTransferTasksRequest) (*GetTransferTasksResponse, error)
	CompleteTransferTask(request *CompleteTransferTaskRequest) error
	RangeCompleteTransferTask(request *RangeCompleteTransferTaskRequest) error

	// Replication task related methods
	GetReplicationTask(request *GetReplicationTaskRequest) (*GetReplicationTaskResponse, error)
	GetReplicationTasks(request *GetReplicationTasksRequest) (*GetReplicationTasksResponse, error)
	CompleteReplicationTask(request *CompleteReplicationTaskRequest) error
	RangeCompleteReplicationTask(request *RangeCompleteReplicationTaskRequest) error
	PutReplicationTaskToDLQ(request *PutReplicationTaskToDLQRequest) error
	GetReplicationTasksFromDLQ(request *GetReplicationTasksFromDLQRequest) (*GetReplicationTasksFromDLQResponse, error)
	DeleteReplicationTaskFromDLQ(request *DeleteReplicationTaskFromDLQRequest) error
	RangeDeleteReplicationTaskFromDLQ(request *RangeDeleteReplicationTaskFromDLQRequest) error

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

	// Scan operations
	ListConcreteExecutions(request *ListConcreteExecutionsRequest) (*ListConcreteExecutionsResponse, 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 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
	GetTransferTask(request *GetTransferTaskRequest) (*GetTransferTaskResponse, error)
	GetTransferTasks(request *GetTransferTasksRequest) (*GetTransferTasksResponse, error)
	CompleteTransferTask(request *CompleteTransferTaskRequest) error
	RangeCompleteTransferTask(request *RangeCompleteTransferTaskRequest) error

	// Replication task related methods
	GetReplicationTask(request *GetReplicationTaskRequest) (*GetReplicationTaskResponse, error)
	GetReplicationTasks(request *GetReplicationTasksRequest) (*GetReplicationTasksResponse, error)
	CompleteReplicationTask(request *CompleteReplicationTaskRequest) error
	RangeCompleteReplicationTask(request *RangeCompleteReplicationTaskRequest) error
	PutReplicationTaskToDLQ(request *PutReplicationTaskToDLQRequest) error
	GetReplicationTasksFromDLQ(request *GetReplicationTasksFromDLQRequest) (*GetReplicationTasksFromDLQResponse, error)
	DeleteReplicationTaskFromDLQ(request *DeleteReplicationTaskFromDLQRequest) error
	RangeDeleteReplicationTaskFromDLQ(request *RangeDeleteReplicationTaskFromDLQRequest) error

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

	// Scan related methods
	ListConcreteExecutions(request *ListConcreteExecutionsRequest) (*InternalListConcreteExecutionsResponse, 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.27.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.27.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 {
	NamespaceID string
	Namespace   string // namespace name is not persisted, but used as config filter key
	Execution   commonpb.WorkflowExecution
}

GetClosedWorkflowExecutionRequest is used retrieve the record for a specific execution

type GetClosedWorkflowExecutionResponse

type GetClosedWorkflowExecutionResponse struct {
	Execution *workflowpb.WorkflowExecutionInfo
}

GetClosedWorkflowExecutionResponse is the response to GetClosedWorkflowExecutionRequest

type GetClusterMembersRequest added in v0.27.0

type GetClusterMembersRequest struct {
	LastHeartbeatWithin time.Duration
	RPCAddressEquals    net.IP
	HostIDEquals        uuid.UUID
	RoleEquals          ServiceType
	SessionStartedAfter time.Time
	NextPageToken       []byte
	PageSize            int
}

GetClusterMembersRequest is the response to GetClusterMembers

type GetClusterMembersResponse added in v0.27.0

type GetClusterMembersResponse struct {
	ActiveMembers []*ClusterMember
	NextPageToken []byte
}

GetClusterMembersResponse is the response to GetClusterMembers

type GetCurrentExecutionRequest

type GetCurrentExecutionRequest struct {
	NamespaceID string
	WorkflowID  string
}

GetCurrentExecutionRequest is used to retrieve the current RunId for an execution

type GetCurrentExecutionResponse

type GetCurrentExecutionResponse struct {
	StartRequestID   string
	RunID            string
	State            enumsspb.WorkflowExecutionState
	Status           enumspb.WorkflowExecutionStatus
	LastWriteVersion int64
}

GetCurrentExecutionResponse is the response to GetCurrentExecution

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 []*persistenceblobs.HistoryBranch
}

GetHistoryTreeResponse is a response to GetHistoryTreeRequest

type GetImmutableClusterMetadataResponse added in v0.27.0

type GetImmutableClusterMetadataResponse struct {
	persistenceblobs.ImmutableClusterMetadata
}

GetImmutableClusterMetadataResponse is the response to GetImmutableClusterMetadata These values are set a single time upon cluster initialization.

type GetMetadataResponse added in v0.3.13

type GetMetadataResponse struct {
	NotificationVersion int64
}

GetMetadataResponse is the response for GetMetadata

type GetNamespaceRequest added in v0.27.0

type GetNamespaceRequest struct {
	ID   string
	Name string
}

GetNamespaceRequest is used to read namespace

type GetNamespaceResponse added in v0.27.0

type GetNamespaceResponse struct {
	Namespace           *persistenceblobs.NamespaceDetail
	IsGlobalNamespace   bool
	NotificationVersion int64
}

GetNamespaceResponse is the response for GetNamespace

type GetReplicationTaskRequest added in v0.27.0

type GetReplicationTaskRequest struct {
	ShardID int32
	TaskID  int64
}

GetReplicationTaskRequest is the request for GetReplicationTask

type GetReplicationTaskResponse added in v0.27.0

type GetReplicationTaskResponse struct {
	ReplicationTaskInfo *persistenceblobs.ReplicationTaskInfo
}

GetReplicationTaskResponse is the response to GetReplicationTask

type GetReplicationTasksFromDLQRequest added in v0.27.0

type GetReplicationTasksFromDLQRequest struct {
	SourceClusterName string
	GetReplicationTasksRequest
}

GetReplicationTasksFromDLQRequest is used to get replication tasks from dlq

func NewGetReplicationTasksFromDLQRequest added in v0.27.0

func NewGetReplicationTasksFromDLQRequest(
	sourceClusterName string,
	readLevel int64,
	maxReadLevel int64,
	batchSize int,
	nextPageToken []byte,
) *GetReplicationTasksFromDLQRequest

NewGetReplicationTasksFromDLQRequest creates a new GetReplicationTasksFromDLQRequest

type GetReplicationTasksFromDLQResponse added in v0.27.0

type GetReplicationTasksFromDLQResponse = GetReplicationTasksResponse

GetReplicationTasksFromDLQResponse is the response for GetReplicationTasksFromDLQ

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         []*persistenceblobs.ReplicationTaskInfo
	NextPageToken []byte
}

GetReplicationTasksResponse is the response to GetReplicationTask

type GetShardRequest

type GetShardRequest struct {
	ShardID int32
}

GetShardRequest is used to get shard information

type GetShardResponse

type GetShardResponse struct {
	ShardInfo *persistenceblobs.ShardInfo
}

GetShardResponse is the response to GetShard

type GetTasksRequest

type GetTasksRequest struct {
	NamespaceID  string
	TaskQueue    string
	TaskType     enumspb.TaskQueueType
	ReadLevel    int64  // range exclusive
	MaxReadLevel *int64 // optional: range inclusive when specified
	BatchSize    int
}

GetTasksRequest is used to retrieve tasks of a task queue

type GetTasksResponse

type GetTasksResponse struct {
	Tasks []*persistenceblobs.AllocatedTaskInfo
}

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        []*persistenceblobs.TimerTaskInfo
	NextPageToken []byte
}

GetTimerIndexTasksResponse is the response for GetTimerIndexTasks

type GetTimerTaskRequest added in v0.27.0

type GetTimerTaskRequest struct {
	ShardID             int32
	TaskID              int64
	VisibilityTimestamp time.Time
}

GetTimerTaskRequest is the request for GetTimerTask

type GetTimerTaskResponse added in v0.27.0

type GetTimerTaskResponse struct {
	TimerTaskInfo *persistenceblobs.TimerTaskInfo
}

GetTimerTaskResponse is the response to GetTimerTask

type GetTransferTaskRequest added in v0.27.0

type GetTransferTaskRequest struct {
	ShardID int32
	TaskID  int64
}

GetTransferTaskRequest is the request for GetTransferTask

type GetTransferTaskResponse added in v0.27.0

type GetTransferTaskResponse struct {
	TransferTaskInfo *persistenceblobs.TransferTaskInfo
}

GetTransferTaskResponse is the response to GetTransferTask

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         []*persistenceblobs.TransferTaskInfo
	NextPageToken []byte
}

GetTransferTasksResponse is the response to GetTransferTasksRequest

type GetWorkflowExecutionRequest

type GetWorkflowExecutionRequest struct {
	NamespaceID string
	Execution   commonpb.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.27.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

	// 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)
	// 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)
}

HistoryManager is used to manager workflow history events

func NewHistoryV2ManagerImpl added in v0.5.0

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

NewHistoryV2ManagerImpl returns new HistoryManager

func NewHistoryV2PersistenceMetricsClient added in v0.5.0

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

NewHistoryV2PersistenceMetricsClient creates a HistoryManager client to manage workflow execution history

func NewHistoryV2PersistenceRateLimitedClient added in v0.5.0

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

NewHistoryV2PersistenceRateLimitedClient 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
	BranchToken         []byte
	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

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

GetVisibilityTime 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

	// 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
	// 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)
}

HistoryStore is to manager workflow history events

type InitializeImmutableClusterMetadataRequest added in v0.27.0

type InitializeImmutableClusterMetadataRequest struct {
	persistenceblobs.ImmutableClusterMetadata
}

InitializeImmutableClusterMetadataRequest is a request of InitializeImmutableClusterMetadata These values can only be set a single time upon cluster initialization.

type InitializeImmutableClusterMetadataResponse added in v0.27.0

type InitializeImmutableClusterMetadataResponse struct {
	PersistedImmutableData persistenceblobs.ImmutableClusterMetadata
	RequestApplied         bool
}

InitializeImmutableClusterMetadataResponse is a request of InitializeImmutableClusterMetadata

type InternalAppendHistoryEventsRequest added in v0.4.0

type InternalAppendHistoryEventsRequest struct {
	NamespaceID       string
	Execution         commonpb.WorkflowExecution
	FirstEventID      int64
	EventBatchVersion int64
	RangeID           int64
	TransactionID     int64
	Events            *serialization.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 *persistenceblobs.HistoryBranch
	// The first eventID becomes the nodeID to be appended
	NodeID int64
	// The events to be appended
	Events *serialization.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 InternalCompleteForkBranchRequest added in v0.5.2

type InternalCompleteForkBranchRequest struct {
	// branch to be updated
	BranchInfo persistenceblobs.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

	Mode ConflictResolveWorkflowMode

	// workflow to be resetted
	ResetWorkflowSnapshot InternalWorkflowSnapshot

	// maybe new workflow
	NewWorkflowSnapshot *InternalWorkflowSnapshot

	// current workflow
	CurrentWorkflowMutation *InternalWorkflowMutation
}

InternalConflictResolveWorkflowExecutionRequest is used to reset workflow execution state for Persistence Interface

type InternalCreateNamespaceRequest added in v0.27.0

type InternalCreateNamespaceRequest struct {
	ID        string
	Name      string
	Namespace *serialization.DataBlob
	IsGlobal  bool
}

InternalCreateNamespaceRequest is used to create the namespace

type InternalCreateWorkflowExecutionRequest added in v0.5.7

type InternalCreateWorkflowExecutionRequest struct {
	RangeID int64

	Mode CreateWorkflowMode

	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 *persistenceblobs.HistoryBranch
	// Used in sharded data stores to identify which shard to use
	ShardID int
}

InternalDeleteHistoryBranchRequest is used to remove a history branch

type InternalForkHistoryBranchRequest added in v0.5.0

type InternalForkHistoryBranchRequest struct {
	// The base branch to fork from
	ForkBranchInfo *persistenceblobs.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 *persistenceblobs.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 InternalGetImmutableClusterMetadataResponse added in v0.27.0

type InternalGetImmutableClusterMetadataResponse struct {
	// Serialized ImmutableCusterMetadata.
	ImmutableClusterMetadata *serialization.DataBlob
}

InternalGetImmutableClusterMetadataResponse is the response to GetImmutableClusterMetadata These values are set a single time upon cluster initialization.

type InternalGetNamespaceResponse added in v0.27.0

type InternalGetNamespaceResponse struct {
	Namespace           *serialization.DataBlob
	IsGlobal            bool
	NotificationVersion int64
}

InternalGetNamespaceResponse is the response for GetNamespace

type InternalGetWorkflowExecutionResponse added in v0.4.0

type InternalGetWorkflowExecutionResponse struct {
	State *InternalWorkflowMutableState
}

InternalGetWorkflowExecutionResponse is the response to GetworkflowExecution for Persistence Interface

type InternalInitializeImmutableClusterMetadataRequest added in v0.27.0

type InternalInitializeImmutableClusterMetadataRequest struct {
	// Serialized ImmutableCusterMetadata to persist.
	ImmutableClusterMetadata *serialization.DataBlob
}

InternalInitializeImmutableClusterMetadataRequest is a request of InitializeImmutableClusterMetadata These values can only be set a single time upon cluster initialization.

type InternalInitializeImmutableClusterMetadataResponse added in v0.27.0

type InternalInitializeImmutableClusterMetadataResponse struct {
	// Serialized ImmutableCusterMetadata that is currently persisted.
	PersistedImmutableMetadata *serialization.DataBlob
	RequestApplied             bool
}

InternalInitializeImmutableClusterMetadataResponse is a request of InitializeImmutableClusterMetadata

type InternalListConcreteExecutionsResponse added in v0.27.0

type InternalListConcreteExecutionsResponse struct {
	ExecutionInfos []*WorkflowExecutionInfo
	NextPageToken  []byte
}

InternalListConcreteExecutionsResponse is the response to ListConcreteExecutions for Persistence Interface

type InternalListNamespacesResponse added in v0.27.0

type InternalListNamespacesResponse struct {
	Namespaces    []*InternalGetNamespaceResponse
	NextPageToken []byte
}

InternalListNamespacesResponse is the response for GetNamespace

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 []*serialization.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 {
	NamespaceID        string
	WorkflowID         string
	RunID              string
	WorkflowTypeName   string
	StartTimestamp     int64
	ExecutionTimestamp int64
	TaskID             int64
	Memo               *serialization.DataBlob
	TaskQueue          string
	SearchAttributes   map[string]*commonpb.Payload
	CloseTimestamp     int64
	Status             enumspb.WorkflowExecutionStatus
	HistoryLength      int64
	RetentionSeconds   int64
}

InternalRecordWorkflowExecutionClosedRequest is request to RecordWorkflowExecutionClosed

type InternalRecordWorkflowExecutionStartedRequest added in v0.5.7

type InternalRecordWorkflowExecutionStartedRequest struct {
	NamespaceID        string
	WorkflowID         string
	RunID              string
	WorkflowTypeName   string
	StartTimestamp     int64
	ExecutionTimestamp int64
	RunTimeout         int64
	TaskID             int64
	Memo               *serialization.DataBlob
	TaskQueue          string
	SearchAttributes   map[string]*commonpb.Payload
}

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 InternalUpdateNamespaceRequest added in v0.27.0

type InternalUpdateNamespaceRequest struct {
	Id                  string
	Name                string
	Namespace           *serialization.DataBlob
	NotificationVersion int64
}

InternalUpdateNamespaceRequest is used to update namespace

type InternalUpdateWorkflowExecutionRequest added in v0.4.0

type InternalUpdateWorkflowExecutionRequest struct {
	RangeID int64

	Mode UpdateWorkflowMode

	UpdateWorkflowMutation InternalWorkflowMutation

	NewWorkflowSnapshot *InternalWorkflowSnapshot
}

InternalUpdateWorkflowExecutionRequest is used to update a workflow execution for Persistence Interface

type InternalUpsertClusterMembershipRequest added in v0.27.0

type InternalUpsertClusterMembershipRequest struct {
	ClusterMember
	RecordExpiry time.Time
}

InternalUpsertClusterMembershipRequest is the request to UpsertClusterMembership

type InternalUpsertWorkflowExecutionRequest added in v0.6.0

type InternalUpsertWorkflowExecutionRequest struct {
	NamespaceID        string
	WorkflowID         string
	RunID              string
	WorkflowTypeName   string
	StartTimestamp     int64
	ExecutionTimestamp int64
	Status             enumspb.WorkflowExecutionStatus
	WorkflowTimeout    int64
	TaskID             int64
	Memo               *serialization.DataBlob
	TaskQueue          string
	SearchAttributes   map[string]*commonpb.Payload
}

InternalUpsertWorkflowExecutionRequest is request to UpsertWorkflowExecution

type InternalWorkflowMutableState added in v0.4.0

type InternalWorkflowMutableState struct {
	ActivityInfos       map[int64]*persistenceblobs.ActivityInfo
	TimerInfos          map[string]*persistenceblobs.TimerInfo
	ChildExecutionInfos map[int64]*persistenceblobs.ChildExecutionInfo
	RequestCancelInfos  map[int64]*persistenceblobs.RequestCancelInfo
	SignalInfos         map[int64]*persistenceblobs.SignalInfo
	SignalRequestedIDs  map[string]struct{}
	ExecutionInfo       *WorkflowExecutionInfo

	BufferedEvents   []*serialization.DataBlob
	VersionHistories *historyspb.VersionHistories
	Checksum         checksum.Checksum
}

InternalWorkflowMutableState indicates workflow related state for Persistence Interface

type InternalWorkflowMutation added in v0.6.0

type InternalWorkflowMutation struct {
	ExecutionInfo    *WorkflowExecutionInfo
	VersionHistories *historyspb.VersionHistories
	StartVersion     int64
	LastWriteVersion int64

	UpsertActivityInfos       []*persistenceblobs.ActivityInfo
	DeleteActivityInfos       []int64
	UpsertTimerInfos          []*persistenceblobs.TimerInfo
	DeleteTimerInfos          []string
	UpsertChildExecutionInfos []*persistenceblobs.ChildExecutionInfo
	DeleteChildExecutionInfo  *int64
	UpsertRequestCancelInfos  []*persistenceblobs.RequestCancelInfo
	DeleteRequestCancelInfo   *int64
	UpsertSignalInfos         []*persistenceblobs.SignalInfo
	DeleteSignalInfo          *int64
	UpsertSignalRequestedIDs  []string
	DeleteSignalRequestedID   string
	NewBufferedEvents         *serialization.DataBlob
	ClearBufferedEvents       bool

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

	Condition int64

	Checksum checksum.Checksum
}

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

type InternalWorkflowSnapshot added in v0.6.0

type InternalWorkflowSnapshot struct {
	ExecutionInfo    *WorkflowExecutionInfo
	VersionHistories *historyspb.VersionHistories
	StartVersion     int64
	LastWriteVersion int64

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

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

	Condition int64

	Checksum checksum.Checksum
}

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 LeaseTaskQueueRequest added in v0.27.0

type LeaseTaskQueueRequest struct {
	NamespaceID   string
	TaskQueue     string
	TaskType      enumspb.TaskQueueType
	TaskQueueKind enumspb.TaskQueueKind
	RangeID       int64
}

LeaseTaskQueueRequest is used to request lease of a task queue

type LeaseTaskQueueResponse added in v0.27.0

type LeaseTaskQueueResponse struct {
	TaskQueueInfo *PersistedTaskQueueInfo
}

LeaseTaskQueueResponse is response to LeaseTaskQueueRequest

type ListClosedWorkflowExecutionsByStatusRequest

type ListClosedWorkflowExecutionsByStatusRequest struct {
	ListWorkflowExecutionsRequest
	Status enumspb.WorkflowExecutionStatus
}

ListClosedWorkflowExecutionsByStatusRequest is used to list executions that have specific close status

type ListConcreteExecutionsRequest added in v0.27.0

type ListConcreteExecutionsRequest struct {
	PageSize  int
	PageToken []byte
}

ListConcreteExecutionsRequest is request to ListConcreteExecutions

type ListConcreteExecutionsResponse added in v0.27.0

type ListConcreteExecutionsResponse struct {
	ExecutionInfos []*WorkflowExecutionInfo
	PageToken      []byte
}

ListConcreteExecutionsResponse is response to ListConcreteExecutions

type ListNamespacesRequest added in v0.27.0

type ListNamespacesRequest struct {
	PageSize      int
	NextPageToken []byte
}

ListNamespacesRequest is used to list namespaces

type ListNamespacesResponse added in v0.27.0

type ListNamespacesResponse struct {
	Namespaces    []*GetNamespaceResponse
	NextPageToken []byte
}

ListNamespacesResponse is the response for GetNamespace

type ListTaskQueueRequest added in v0.27.0

type ListTaskQueueRequest struct {
	PageSize  int
	PageToken []byte
}

ListTaskQueueRequest contains the request params needed to invoke ListTaskQueue API

type ListTaskQueueResponse added in v0.27.0

type ListTaskQueueResponse struct {
	Items         []*PersistedTaskQueueInfo
	NextPageToken []byte
}

ListTaskQueueResponse is the response from ListTaskQueue API

type ListWorkflowExecutionsByTypeRequest

type ListWorkflowExecutionsByTypeRequest struct {
	ListWorkflowExecutionsRequest
	WorkflowTypeName string
}

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

type ListWorkflowExecutionsByWorkflowIDRequest

type ListWorkflowExecutionsByWorkflowIDRequest struct {
	ListWorkflowExecutionsRequest
	WorkflowID string
}

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

type ListWorkflowExecutionsRequest

type ListWorkflowExecutionsRequest struct {
	NamespaceID       string
	Namespace         string // namespace 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 namespace

type ListWorkflowExecutionsRequestV2 added in v0.5.7

type ListWorkflowExecutionsRequestV2 struct {
	NamespaceID string
	Namespace   string // namespace 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 namespace

type ListWorkflowExecutionsResponse

type ListWorkflowExecutionsResponse struct {
	Executions []*workflowpb.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
	CreateNamespace(request *CreateNamespaceRequest) (*CreateNamespaceResponse, error)
	GetNamespace(request *GetNamespaceRequest) (*GetNamespaceResponse, error)
	UpdateNamespace(request *UpdateNamespaceRequest) error
	DeleteNamespace(request *DeleteNamespaceRequest) error
	DeleteNamespaceByName(request *DeleteNamespaceByNameRequest) error
	ListNamespaces(request *ListNamespacesRequest) (*ListNamespacesResponse, error)
	GetMetadata() (*GetMetadataResponse, error)
	InitializeSystemNamespaces(currentClusterName string) error
}

MetadataManager is used to manage metadata CRUD for namespace entities

func NewMetadataManagerImpl added in v0.5.8

func NewMetadataManagerImpl(persistence MetadataStore, logger log.Logger, clusterName string) 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
	CreateNamespace(request *InternalCreateNamespaceRequest) (*CreateNamespaceResponse, error)
	GetNamespace(request *GetNamespaceRequest) (*InternalGetNamespaceResponse, error)
	UpdateNamespace(request *InternalUpdateNamespaceRequest) error
	DeleteNamespace(request *DeleteNamespaceRequest) error
	DeleteNamespaceByName(request *DeleteNamespaceByNameRequest) error
	ListNamespaces(request *ListNamespacesRequest) (*InternalListNamespacesResponse, error)
	GetMetadata() (*GetMetadataResponse, error)
}

MetadataStore is a lower level of MetadataManager

type MockNamespaceReplicationQueue added in v0.27.0

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

MockNamespaceReplicationQueue is a mock of NamespaceReplicationQueue interface.

func NewMockNamespaceReplicationQueue added in v0.27.0

func NewMockNamespaceReplicationQueue(ctrl *gomock.Controller) *MockNamespaceReplicationQueue

NewMockNamespaceReplicationQueue creates a new mock instance.

func (*MockNamespaceReplicationQueue) DeleteMessageFromDLQ added in v0.27.0

func (m *MockNamespaceReplicationQueue) DeleteMessageFromDLQ(messageID int64) error

DeleteMessageFromDLQ mocks base method.

func (*MockNamespaceReplicationQueue) EXPECT added in v0.27.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockNamespaceReplicationQueue) GetAckLevels added in v0.27.0

func (m *MockNamespaceReplicationQueue) GetAckLevels() (map[string]int64, error)

GetAckLevels mocks base method.

func (*MockNamespaceReplicationQueue) GetDLQAckLevel added in v0.27.0

func (m *MockNamespaceReplicationQueue) GetDLQAckLevel() (int64, error)

GetDLQAckLevel mocks base method.

func (*MockNamespaceReplicationQueue) GetMessagesFromDLQ added in v0.27.0

func (m *MockNamespaceReplicationQueue) GetMessagesFromDLQ(firstMessageID, lastMessageID int64, pageSize int, pageToken []byte) ([]*repication.ReplicationTask, []byte, error)

GetMessagesFromDLQ mocks base method.

func (*MockNamespaceReplicationQueue) GetReplicationMessages added in v0.27.0

func (m *MockNamespaceReplicationQueue) GetReplicationMessages(lastMessageID int64, maxCount int) ([]*repication.ReplicationTask, int64, error)

GetReplicationMessages mocks base method.

func (*MockNamespaceReplicationQueue) Publish added in v0.27.0

func (m *MockNamespaceReplicationQueue) Publish(message interface{}) error

Publish mocks base method.

func (*MockNamespaceReplicationQueue) PublishToDLQ added in v0.27.0

func (m *MockNamespaceReplicationQueue) PublishToDLQ(message interface{}) error

PublishToDLQ mocks base method.

func (*MockNamespaceReplicationQueue) RangeDeleteMessagesFromDLQ added in v0.27.0

func (m *MockNamespaceReplicationQueue) RangeDeleteMessagesFromDLQ(firstMessageID, lastMessageID int64) error

RangeDeleteMessagesFromDLQ mocks base method.

func (*MockNamespaceReplicationQueue) Start added in v0.27.0

func (m *MockNamespaceReplicationQueue) Start()

Start mocks base method.

func (*MockNamespaceReplicationQueue) Stop added in v0.27.0

Stop mocks base method.

func (*MockNamespaceReplicationQueue) UpdateAckLevel added in v0.27.0

func (m *MockNamespaceReplicationQueue) UpdateAckLevel(lastProcessedMessageID int64, clusterName string) error

UpdateAckLevel mocks base method.

func (*MockNamespaceReplicationQueue) UpdateDLQAckLevel added in v0.27.0

func (m *MockNamespaceReplicationQueue) UpdateDLQAckLevel(lastProcessedMessageID int64) error

UpdateDLQAckLevel mocks base method.

type MockNamespaceReplicationQueueMockRecorder added in v0.27.0

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

MockNamespaceReplicationQueueMockRecorder is the mock recorder for MockNamespaceReplicationQueue.

func (*MockNamespaceReplicationQueueMockRecorder) DeleteMessageFromDLQ added in v0.27.0

func (mr *MockNamespaceReplicationQueueMockRecorder) DeleteMessageFromDLQ(messageID interface{}) *gomock.Call

DeleteMessageFromDLQ indicates an expected call of DeleteMessageFromDLQ.

func (*MockNamespaceReplicationQueueMockRecorder) GetAckLevels added in v0.27.0

GetAckLevels indicates an expected call of GetAckLevels.

func (*MockNamespaceReplicationQueueMockRecorder) GetDLQAckLevel added in v0.27.0

GetDLQAckLevel indicates an expected call of GetDLQAckLevel.

func (*MockNamespaceReplicationQueueMockRecorder) GetMessagesFromDLQ added in v0.27.0

func (mr *MockNamespaceReplicationQueueMockRecorder) GetMessagesFromDLQ(firstMessageID, lastMessageID, pageSize, pageToken interface{}) *gomock.Call

GetMessagesFromDLQ indicates an expected call of GetMessagesFromDLQ.

func (*MockNamespaceReplicationQueueMockRecorder) GetReplicationMessages added in v0.27.0

func (mr *MockNamespaceReplicationQueueMockRecorder) GetReplicationMessages(lastMessageID, maxCount interface{}) *gomock.Call

GetReplicationMessages indicates an expected call of GetReplicationMessages.

func (*MockNamespaceReplicationQueueMockRecorder) Publish added in v0.27.0

func (mr *MockNamespaceReplicationQueueMockRecorder) Publish(message interface{}) *gomock.Call

Publish indicates an expected call of Publish.

func (*MockNamespaceReplicationQueueMockRecorder) PublishToDLQ added in v0.27.0

func (mr *MockNamespaceReplicationQueueMockRecorder) PublishToDLQ(message interface{}) *gomock.Call

PublishToDLQ indicates an expected call of PublishToDLQ.

func (*MockNamespaceReplicationQueueMockRecorder) RangeDeleteMessagesFromDLQ added in v0.27.0

func (mr *MockNamespaceReplicationQueueMockRecorder) RangeDeleteMessagesFromDLQ(firstMessageID, lastMessageID interface{}) *gomock.Call

RangeDeleteMessagesFromDLQ indicates an expected call of RangeDeleteMessagesFromDLQ.

func (*MockNamespaceReplicationQueueMockRecorder) Start added in v0.27.0

Start indicates an expected call of Start.

func (*MockNamespaceReplicationQueueMockRecorder) Stop added in v0.27.0

Stop indicates an expected call of Stop.

func (*MockNamespaceReplicationQueueMockRecorder) UpdateAckLevel added in v0.27.0

func (mr *MockNamespaceReplicationQueueMockRecorder) UpdateAckLevel(lastProcessedMessageID, clusterName interface{}) *gomock.Call

UpdateAckLevel indicates an expected call of UpdateAckLevel.

func (*MockNamespaceReplicationQueueMockRecorder) UpdateDLQAckLevel added in v0.27.0

func (mr *MockNamespaceReplicationQueueMockRecorder) UpdateDLQAckLevel(lastProcessedMessageID interface{}) *gomock.Call

UpdateDLQAckLevel indicates an expected call of UpdateDLQAckLevel.

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 NamespaceReplicationQueue added in v0.27.0

type NamespaceReplicationQueue interface {
	common.Daemon
	Publish(message interface{}) error
	PublishToDLQ(message interface{}) error
	GetReplicationMessages(lastMessageID int64, maxCount int) ([]*replicationspb.ReplicationTask, int64, error)
	UpdateAckLevel(lastProcessedMessageID int64, clusterName string) error
	GetAckLevels() (map[string]int64, error)
	GetMessagesFromDLQ(firstMessageID int64, lastMessageID int64, pageSize int, pageToken []byte) ([]*replicationspb.ReplicationTask, []byte, error)
	UpdateDLQAckLevel(lastProcessedMessageID int64) error
	GetDLQAckLevel() (int64, error)
	RangeDeleteMessagesFromDLQ(firstMessageID int64, lastMessageID int64) error
	DeleteMessageFromDLQ(messageID int64) error
}

NamespaceReplicationQueue is used to publish and list namespace replication tasks

func NewNamespaceReplicationQueue added in v0.27.0

func NewNamespaceReplicationQueue(
	queue Queue,
	clusterName string,
	metricsClient metrics.Client,
	logger log.Logger,
) NamespaceReplicationQueue

NewNamespaceReplicationQueue creates a new NamespaceReplicationQueue instance

type PayloadSerializer added in v0.5.7

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

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

	// serialize/deserialize visibility memo fields
	SerializeVisibilityMemo(memo *commonpb.Memo, encodingType enumspb.EncodingType) (*serialization.DataBlob, error)
	DeserializeVisibilityMemo(data *serialization.DataBlob) (*commonpb.Memo, error)

	// serialize/deserialize reset points
	SerializeResetPoints(event *workflowpb.ResetPoints, encodingType enumspb.EncodingType) (*serialization.DataBlob, error)
	DeserializeResetPoints(data *serialization.DataBlob) (*workflowpb.ResetPoints, error)

	// serialize/deserialize bad binaries
	SerializeBadBinaries(event *namespacepb.BadBinaries, encodingType enumspb.EncodingType) (*serialization.DataBlob, error)
	DeserializeBadBinaries(data *serialization.DataBlob) (*namespacepb.BadBinaries, error)

	// serialize/deserialize version histories
	SerializeVersionHistories(histories *historyspb.VersionHistories, encodingType enumspb.EncodingType) (*serialization.DataBlob, error)
	DeserializeVersionHistories(data *serialization.DataBlob) (*historyspb.VersionHistories, error)

	// serialize/deserialize immutable cluster metadata
	SerializeImmutableClusterMetadata(icm *persistenceblobs.ImmutableClusterMetadata, encodingType enumspb.EncodingType) (*serialization.DataBlob, error)
	DeserializeImmutableClusterMetadata(data *serialization.DataBlob) (*persistenceblobs.ImmutableClusterMetadata, 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 PersistedTaskQueueInfo added in v0.27.0

type PersistedTaskQueueInfo struct {
	Data    *persistenceblobs.TaskQueueInfo
	RangeID int64
}

type PruneClusterMembershipRequest added in v0.27.0

type PruneClusterMembershipRequest struct {
	MaxRecordsPruned int
}

PruneClusterMembershipRequest is the request to PruneClusterMembership

type PutReplicationTaskToDLQRequest added in v0.27.0

type PutReplicationTaskToDLQRequest struct {
	SourceClusterName string
	TaskInfo          *persistenceblobs.ReplicationTaskInfo
}

PutReplicationTaskToDLQRequest is used to put a replication task to dlq

type Queue added in v0.27.0

type Queue interface {
	Closeable
	EnqueueMessage(messagePayload []byte) error
	ReadMessages(lastMessageID int64, maxCount int) ([]*QueueMessage, error)
	DeleteMessagesBefore(messageID int64) error
	UpdateAckLevel(messageID int64, clusterName string) error
	GetAckLevels() (map[string]int64, error)
	EnqueueMessageToDLQ(messagePayload []byte) (int64, error)
	ReadMessagesFromDLQ(firstMessageID int64, lastMessageID int64, pageSize int, pageToken []byte) ([]*QueueMessage, []byte, error)
	DeleteMessageFromDLQ(messageID int64) error
	RangeDeleteMessagesFromDLQ(firstMessageID int64, lastMessageID int64) error
	UpdateDLQAckLevel(messageID int64, clusterName string) error
	GetDLQAckLevels() (map[string]int64, error)
}

Queue is a store to enqueue and get messages

func NewQueuePersistenceMetricsClient added in v0.27.0

func NewQueuePersistenceMetricsClient(persistence Queue, metricClient metrics.Client, logger log.Logger) Queue

NewQueuePersistenceMetricsClient creates a client to manage queue

func NewQueuePersistenceRateLimitedClient added in v0.27.0

func NewQueuePersistenceRateLimitedClient(persistence Queue, rateLimiter quotas.Limiter, logger log.Logger) Queue

NewQueuePersistenceRateLimitedClient creates a client to manage queue

type QueueMessage added in v0.27.0

type QueueMessage struct {
	ID        int64     `json:"message_id"`
	QueueType QueueType `json:"queue_type"`
	Payload   []byte    `json:"message_payload"`
}

QueueMessage is the message that stores in the queue

type QueueType added in v0.27.0

type QueueType int

QueueType is an enum that represents various queue types in persistence

const (
	NamespaceReplicationQueueType QueueType = iota + 1
)

Queue types used in queue table Use positive numbers for queue type Negative numbers are reserved for DLQ

type RangeCompleteReplicationTaskRequest added in v0.27.0

type RangeCompleteReplicationTaskRequest struct {
	InclusiveEndTaskID int64
}

RangeCompleteReplicationTaskRequest is used to complete a range of task in the replication task queue

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 RangeDeleteReplicationTaskFromDLQRequest added in v0.27.0

type RangeDeleteReplicationTaskFromDLQRequest struct {
	SourceClusterName    string
	ExclusiveBeginTaskID int64
	InclusiveEndTaskID   int64
}

RangeDeleteReplicationTaskFromDLQRequest is used to delete replication tasks from DLQ

type ReadHistoryBranchByBatchResponse added in v0.5.0

type ReadHistoryBranchByBatchResponse struct {
	// History events by batch
	History []*historypb.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
	// event id of the last event in the last loaded batch
	LastEventID 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 []*historypb.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.27.0

type ReadRawHistoryBranchResponse struct {
	// HistoryEventBlobs history event blobs
	HistoryEventBlobs []*serialization.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 {
	NamespaceID        string
	Namespace          string // not persisted, used as config filter key
	Execution          commonpb.WorkflowExecution
	WorkflowTypeName   string
	StartTimestamp     int64
	ExecutionTimestamp int64
	CloseTimestamp     int64
	Status             enumspb.WorkflowExecutionStatus
	HistoryLength      int64
	RetentionSeconds   int64
	TaskID             int64 // not persisted, used as condition update version for ES
	Memo               *commonpb.Memo
	TaskQueue          string
	SearchAttributes   map[string]*commonpb.Payload
}

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

type RecordWorkflowExecutionStartedRequest

type RecordWorkflowExecutionStartedRequest struct {
	NamespaceID        string
	Namespace          string // not persisted, used as config filter key
	Execution          commonpb.WorkflowExecution
	WorkflowTypeName   string
	StartTimestamp     int64
	ExecutionTimestamp int64
	RunTimeout         int64 // not persisted, used for cassandra ttl
	TaskID             int64 // not persisted, used as condition update version for ES
	Memo               *commonpb.Memo
	TaskQueue          string
	SearchAttributes   map[string]*commonpb.Payload
}

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

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

GetVisibilityTime 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 ReplicationTaskInfoWrapper added in v0.27.0

type ReplicationTaskInfoWrapper struct {
	*persistenceblobs.ReplicationTaskInfo
}

ReplicationTaskInfoWrapper describes a replication task.

func (*ReplicationTaskInfoWrapper) GetVisibilityTime added in v0.27.0

func (d *ReplicationTaskInfoWrapper) GetVisibilityTime() *time.Time

GetVisibilityTime get the visibility timestamp

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
}

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() enumsspb.TaskType

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

GetVisibilityTime 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 SerializationError added in v0.27.0

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

SerializationError is an error type for serialization

func NewSerializationError added in v0.27.0

func NewSerializationError(msg string) *SerializationError

NewSerializationError returns a SerializationError

func (*SerializationError) Error added in v0.27.0

func (e *SerializationError) Error() string

type ServiceType added in v0.27.0

type ServiceType int
const (
	All ServiceType = iota
	Frontend
	History
	Matching
	Worker
)

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 ShardInfoWithFailover added in v0.27.0

type ShardInfoWithFailover struct {
	*persistenceblobs.ShardInfo
	TransferFailoverLevels map[string]TransferFailoverLevel // uuid -> TransferFailoverLevel
	TimerFailoverLevels    map[string]TimerFailoverLevel    // uuid -> TimerFailoverLevel
}

ShardInfoWithFailover 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
	TargetNamespaceID       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() enumsspb.TaskType

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

GetVisibilityTime 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 StartChildExecutionTask

type StartChildExecutionTask struct {
	VisibilityTimestamp time.Time
	TaskID              int64
	TargetNamespaceID   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

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

GetVisibilityTime 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() enumsspb.TaskType

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

GetVisibilityTime 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() enumsspb.TaskType
	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 TaskManager

type TaskManager interface {
	Closeable
	GetName() string
	LeaseTaskQueue(request *LeaseTaskQueueRequest) (*LeaseTaskQueueResponse, error)
	UpdateTaskQueue(request *UpdateTaskQueueRequest) (*UpdateTaskQueueResponse, error)
	ListTaskQueue(request *ListTaskQueueRequest) (*ListTaskQueueResponse, error)
	DeleteTaskQueue(request *DeleteTaskQueueRequest) 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 TaskQueueKey added in v0.27.0

type TaskQueueKey struct {
	NamespaceID string
	Name        string
	TaskType    enumspb.TaskQueueType
}

TaskQueueKey is the struct used to identity TaskQueues

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
	NamespaceIDs map[string]struct{}
}

TimerFailoverLevel contains namespace IDs and corresponding start / end level

type TimerInfo

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

TimerInfo details - metadata about user timer info.

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
	NamespaceIDs map[string]struct{}
}

TransferFailoverLevel contains corresponding start / end level

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 UpdateNamespaceRequest added in v0.27.0

type UpdateNamespaceRequest struct {
	Namespace           *persistenceblobs.NamespaceDetail
	NotificationVersion int64
}

UpdateNamespaceRequest is used to update namespace

type UpdateShardRequest

type UpdateShardRequest struct {
	ShardInfo       *persistenceblobs.ShardInfo
	PreviousRangeID int64
}

UpdateShardRequest is used to update shard information

type UpdateTaskQueueRequest added in v0.27.0

type UpdateTaskQueueRequest struct {
	RangeID       int64
	TaskQueueInfo *persistenceblobs.TaskQueueInfo
}

UpdateTaskQueueRequest is used to update task queue implementation information

type UpdateTaskQueueResponse added in v0.27.0

type UpdateTaskQueueResponse struct {
}

UpdateTaskQueueResponse is the response to UpdateTaskQueue

type UpdateWorkflowExecutionRequest

type UpdateWorkflowExecutionRequest struct {
	RangeID int64

	Mode UpdateWorkflowMode

	UpdateWorkflowMutation WorkflowMutation

	NewWorkflowSnapshot *WorkflowSnapshot
}

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 UpdateWorkflowMode added in v0.27.0

type UpdateWorkflowMode int

UpdateWorkflowMode update mode

const (
	// Update workflow, including current record
	// NOTE: update on current record is a condition update
	UpdateWorkflowModeUpdateCurrent UpdateWorkflowMode = iota
	// Update workflow, without current record
	// NOTE: current record CANNOT point to the workflow to be updated
	UpdateWorkflowModeBypassCurrent
)

Update Workflow Execution Mode

type UpsertClusterMembershipRequest added in v0.27.0

type UpsertClusterMembershipRequest struct {
	Role         ServiceType
	HostID       uuid.UUID
	RPCAddress   net.IP
	RPCPort      uint16
	SessionStart time.Time
	RecordExpiry time.Duration
}

UpsertClusterMembershipRequest is the request to UpsertClusterMembership

type UpsertWorkflowExecutionRequest added in v0.6.0

type UpsertWorkflowExecutionRequest struct {
	NamespaceID        string
	Namespace          string // not persisted, used as config filter key
	Execution          commonpb.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
	Status             enumspb.WorkflowExecutionStatus
	Memo               *commonpb.Memo
	TaskQueue          string
	SearchAttributes   map[string]*commonpb.Payload
}

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

GetVisibilityTime 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() enumsspb.TaskType

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

GetVisibilityTime 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 {
	CurrentVersionHistoryIndex int
	Histories                  []*VersionHistory
}

VersionHistories contains a set of VersionHistory

func NewVersionHistories added in v0.5.8

func NewVersionHistories(
	versionHistory *VersionHistory,
) *VersionHistories

NewVersionHistories create a new version histories

func NewVersionHistoriesFromProto added in v0.27.0

func NewVersionHistoriesFromProto(
	input *historyspb.VersionHistories,
) *VersionHistories

NewVersionHistoriesFromProto create a new version histories from thrift object

func (*VersionHistories) AddVersionHistory added in v0.27.0

func (h *VersionHistories) AddVersionHistory(
	v *VersionHistory,
) (bool, int, error)

AddVersionHistory add a version history and return the whether current branch is changed

func (*VersionHistories) Duplicate added in v0.27.0

func (h *VersionHistories) Duplicate() *VersionHistories

Duplicate duplicate VersionHistories

func (*VersionHistories) FindFirstVersionHistoryIndexByItem added in v0.27.0

func (h *VersionHistories) FindFirstVersionHistoryIndexByItem(
	item *VersionHistoryItem,
) (int, error)

FindFirstVersionHistoryIndexByItem find the first version history index which contains the given version history item

func (*VersionHistories) FindLCAVersionHistoryIndexAndItem added in v0.27.0

func (h *VersionHistories) FindLCAVersionHistoryIndexAndItem(
	incomingHistory *VersionHistory,
) (int, *VersionHistoryItem, error)

FindLCAVersionHistoryIndexAndItem finds the lowest common ancestor version history index along with corresponding item

func (*VersionHistories) GetCurrentVersionHistory added in v0.27.0

func (h *VersionHistories) GetCurrentVersionHistory() (*VersionHistory, error)

GetCurrentVersionHistory get the current version history

func (*VersionHistories) GetCurrentVersionHistoryIndex added in v0.27.0

func (h *VersionHistories) GetCurrentVersionHistoryIndex() int

GetCurrentVersionHistoryIndex get the current branch index

func (*VersionHistories) GetVersionHistory added in v0.27.0

func (h *VersionHistories) GetVersionHistory(
	branchIndex int,
) (*VersionHistory, error)

GetVersionHistory get the version history according to index provided

func (*VersionHistories) IsRebuilt added in v0.27.0

func (h *VersionHistories) IsRebuilt() (bool, error)

IsRebuilt returns true if the current branch index's last write version is not the largest among all branches' last write version

func (*VersionHistories) SetCurrentVersionHistoryIndex added in v0.27.0

func (h *VersionHistories) SetCurrentVersionHistoryIndex(
	index int,
) error

SetCurrentVersionHistoryIndex set the current branch index

func (*VersionHistories) ToProto added in v0.27.0

ToProto return thrift format of version histories

type VersionHistory added in v0.5.8

type VersionHistory struct {
	BranchToken []byte
	Items       []*VersionHistoryItem
}

VersionHistory provides operations on version history

func NewVersionHistory added in v0.5.8

func NewVersionHistory(
	inputToken []byte,
	inputItems []*VersionHistoryItem,
) *VersionHistory

NewVersionHistory create a new version history

func NewVersionHistoryFromProto added in v0.27.0

func NewVersionHistoryFromProto(
	input *historyspb.VersionHistory,
) *VersionHistory

NewVersionHistoryFromProto create a new version history from thrift object

func (*VersionHistory) AddOrUpdateItem added in v0.27.0

func (v *VersionHistory) AddOrUpdateItem(
	item *VersionHistoryItem,
) error

AddOrUpdateItem updates the versionHistory slice

func (*VersionHistory) ContainsItem added in v0.27.0

func (v *VersionHistory) ContainsItem(
	item *VersionHistoryItem,
) bool

ContainsItem check whether given version history item is included

func (*VersionHistory) Duplicate added in v0.27.0

func (v *VersionHistory) Duplicate() *VersionHistory

Duplicate duplicate VersionHistory

func (*VersionHistory) DuplicateUntilLCAItem added in v0.27.0

func (v *VersionHistory) DuplicateUntilLCAItem(
	lcaItem *VersionHistoryItem,
) (*VersionHistory, error)

DuplicateUntilLCAItem duplicate the version history up until LCA item

func (*VersionHistory) Equals added in v0.27.0

func (v *VersionHistory) Equals(
	input *VersionHistory,
) bool

Equals test if this version history and input version history are the same

func (*VersionHistory) FindLCAItem added in v0.27.0

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

FindLCAItem returns the lowest common ancestor version history item

func (*VersionHistory) GetBranchToken added in v0.27.0

func (v *VersionHistory) GetBranchToken() []byte

GetBranchToken return the branch token

func (*VersionHistory) GetEventVersion added in v0.27.0

func (v *VersionHistory) GetEventVersion(
	eventID int64,
) (int64, error)

GetEventVersion return the corresponding event version of an event ID

func (*VersionHistory) GetFirstItem added in v0.27.0

func (v *VersionHistory) GetFirstItem() (*VersionHistoryItem, error)

GetFirstItem return the first version history item

func (*VersionHistory) GetLastItem added in v0.27.0

func (v *VersionHistory) GetLastItem() (*VersionHistoryItem, error)

GetLastItem return the last version history item

func (*VersionHistory) IsEmpty added in v0.27.0

func (v *VersionHistory) IsEmpty() bool

IsEmpty indicate whether version history is empty

func (*VersionHistory) IsLCAAppendable added in v0.27.0

func (v *VersionHistory) IsLCAAppendable(
	item *VersionHistoryItem,
) bool

IsLCAAppendable checks if a LCA version history item is appendable

func (*VersionHistory) SetBranchToken added in v0.27.0

func (v *VersionHistory) SetBranchToken(
	inputToken []byte,
) error

SetBranchToken the overwrite the branch token

func (*VersionHistory) ToProto added in v0.27.0

ToProto returns proto format of version history

type VersionHistoryItem added in v0.5.8

type VersionHistoryItem struct {
	EventID int64
	Version int64
}

VersionHistoryItem contains the event id and the associated version

func NewVersionHistoryItem added in v0.27.0

func NewVersionHistoryItem(
	inputEventID int64,
	inputVersion int64,
) *VersionHistoryItem

NewVersionHistoryItem create a new version history item

func NewVersionHistoryItemFromProto added in v0.27.0

func NewVersionHistoryItemFromProto(
	input *historyspb.VersionHistoryItem,
) *VersionHistoryItem

NewVersionHistoryItemFromProto create a new version history item from thrift object

func (*VersionHistoryItem) Duplicate added in v0.27.0

func (item *VersionHistoryItem) Duplicate() *VersionHistoryItem

Duplicate duplicate VersionHistoryItem

func (*VersionHistoryItem) Equals added in v0.27.0

func (item *VersionHistoryItem) Equals(input *VersionHistoryItem) bool

Equals test if this version history itme and input version history item are the same

func (*VersionHistoryItem) GetEventID added in v0.27.0

func (item *VersionHistoryItem) GetEventID() int64

GetEventID return the event ID

func (*VersionHistoryItem) GetVersion added in v0.27.0

func (item *VersionHistoryItem) GetVersion() int64

GetVersion return the event ID

func (*VersionHistoryItem) ToProto added in v0.27.0

ToProto returns proto format of version history item

type VisibilityDeleteWorkflowExecutionRequest added in v0.5.7

type VisibilityDeleteWorkflowExecutionRequest struct {
	NamespaceID 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.BoolPropertyFnWithNamespaceFilter,
	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           enumspb.WorkflowExecutionStatus
	HistoryLength    int64
	Memo             *serialization.DataBlob
	TaskQueue        string
	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
	WorkflowBackoffType enumsspb.WorkflowBackoffType
}

WorkflowBackoffTimerTask to schedule first workflow 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

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

GetVisibilityTime 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 {
	NamespaceID string
	WorkflowID  string
	RunID       string
	BranchToken []byte
	Events      []*historypb.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            enumsspb.WorkflowExecutionState
	Status           enumspb.WorkflowExecutionStatus
	LastWriteVersion int64
}

WorkflowExecutionAlreadyStartedError is returned when creating a new workflow failed.

func (*WorkflowExecutionAlreadyStartedError) Error added in v0.3.5

type WorkflowExecutionInfo

type WorkflowExecutionInfo struct {
	ExecutionState                         *persistenceblobs.WorkflowExecutionState
	NamespaceId                            string
	WorkflowId                             string
	FirstExecutionRunId                    string
	ParentNamespaceId                      string
	ParentWorkflowId                       string
	ParentRunId                            string
	InitiatedId                            int64
	CompletionEventBatchId                 int64
	CompletionEvent                        *historypb.HistoryEvent
	TaskQueue                              string
	WorkflowTypeName                       string
	WorkflowRunTimeout                     *time.Duration
	WorkflowExecutionTimeout               *time.Duration
	DefaultWorkflowTaskTimeout             *time.Duration
	LastFirstEventId                       int64
	LastEventTaskId                        int64
	NextEventId                            int64
	LastProcessedEvent                     int64
	StartTime                              *time.Time
	LastUpdatedTime                        *time.Time
	SignalCount                            int64
	WorkflowTaskVersion                    int64
	WorkflowTaskScheduleId                 int64
	WorkflowTaskStartedId                  int64
	WorkflowTaskRequestId                  string
	WorkflowTaskTimeout                    *time.Duration
	WorkflowTaskAttempt                    int32
	WorkflowTaskStartedTimestamp           *time.Time
	WorkflowTaskScheduledTimestamp         *time.Time
	WorkflowTaskOriginalScheduledTimestamp *time.Time
	CancelRequested                        bool
	CancelRequestId                        string
	StickyTaskQueue                        string
	StickyScheduleToStartTimeout           *time.Duration
	AutoResetPoints                        *workflowpb.ResetPoints
	Memo                                   map[string]*commonpb.Payload
	SearchAttributes                       map[string]*commonpb.Payload
	// for retry
	Attempt                     int32
	HasRetryPolicy              bool
	RetryInitialInterval        *time.Duration
	RetryBackoffCoefficient     float64
	RetryMaximumInterval        *time.Duration
	WorkflowExpirationTime      *time.Time
	RetryMaximumAttempts        int32
	RetryNonRetryableErrorTypes []string
	EventBranchToken            []byte
	// Cron
	CronSchedule   string
	ExecutionStats *persistenceblobs.ExecutionStats
}

WorkflowExecutionInfo describes a workflow execution

func WorkflowExecutionFromProto added in v0.30.0

func WorkflowExecutionFromProto(info *persistenceblobs.WorkflowExecutionInfo, state *persistenceblobs.WorkflowExecutionState, nextEventID int64) *WorkflowExecutionInfo

func (*WorkflowExecutionInfo) GetExecutionState added in v0.30.0

func (e *WorkflowExecutionInfo) GetExecutionState() *persistenceblobs.WorkflowExecutionState

GetExecutionState gets the new field for ExecutionState

func (*WorkflowExecutionInfo) GetRunId added in v0.30.0

func (e *WorkflowExecutionInfo) GetRunId() string

GetRunId gets the runId

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

func (*WorkflowExecutionInfo) UpdateWorkflowStateStatus added in v0.27.0

func (e *WorkflowExecutionInfo) UpdateWorkflowStateStatus(
	state enumsspb.WorkflowExecutionState,
	status enumspb.WorkflowExecutionStatus,
) error

UpdateWorkflowStateStatus update the workflow state

type WorkflowMutableState

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

WorkflowMutableState indicates workflow related state

type WorkflowMutation added in v0.6.0

type WorkflowMutation struct {
	ExecutionInfo    *WorkflowExecutionInfo
	ExecutionStats   *persistenceblobs.ExecutionStats
	VersionHistories *VersionHistories

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

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

	Condition int64
	Checksum  checksum.Checksum
}

WorkflowMutation is used as generic workflow execution state mutation

type WorkflowSnapshot added in v0.6.0

type WorkflowSnapshot struct {
	ExecutionInfo    *WorkflowExecutionInfo
	ExecutionStats   *persistenceblobs.ExecutionStats
	VersionHistories *VersionHistories

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

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

	Condition int64
	Checksum  checksum.Checksum
}

WorkflowSnapshot is used as generic workflow execution state snapshot

type WorkflowTask added in v0.27.0

type WorkflowTask struct {
	VisibilityTimestamp time.Time
	TaskID              int64
	NamespaceID         string
	TaskQueue           string
	ScheduleID          int64
	Version             int64
	RecordVisibility    bool
}

WorkflowTask identifies a transfer task for workflow task

func (*WorkflowTask) GetTaskID added in v0.27.0

func (d *WorkflowTask) GetTaskID() int64

GetTaskID returns the sequence ID of the workflow task.

func (*WorkflowTask) GetType added in v0.27.0

func (d *WorkflowTask) GetType() enumsspb.TaskType

GetType returns the type of the workflow task

func (*WorkflowTask) GetVersion added in v0.27.0

func (d *WorkflowTask) GetVersion() int64

GetVersion returns the version of the workflow task

func (*WorkflowTask) GetVisibilityTimestamp added in v0.27.0

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

GetVisibilityTime get the visibility timestamp

func (*WorkflowTask) SetTaskID added in v0.27.0

func (d *WorkflowTask) SetTaskID(id int64)

SetTaskID sets the sequence ID of the workflow task

func (*WorkflowTask) SetVersion added in v0.27.0

func (d *WorkflowTask) SetVersion(version int64)

SetVersion returns the version of the workflow task

func (*WorkflowTask) SetVisibilityTimestamp added in v0.27.0

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

SetVisibilityTimestamp set the visibility timestamp

type WorkflowTaskTimeoutTask added in v0.27.0

type WorkflowTaskTimeoutTask struct {
	VisibilityTimestamp time.Time
	TaskID              int64
	EventID             int64
	ScheduleAttempt     int32
	TimeoutType         enumspb.TimeoutType
	Version             int64
}

WorkflowTaskTimeoutTask identifies a timeout task.

func (*WorkflowTaskTimeoutTask) GetTaskID added in v0.27.0

func (d *WorkflowTaskTimeoutTask) GetTaskID() int64

GetTaskID returns the sequence ID.

func (*WorkflowTaskTimeoutTask) GetType added in v0.27.0

GetType returns the type of the timer task

func (*WorkflowTaskTimeoutTask) GetVersion added in v0.27.0

func (d *WorkflowTaskTimeoutTask) GetVersion() int64

GetVersion returns the version of the timer task

func (*WorkflowTaskTimeoutTask) GetVisibilityTimestamp added in v0.27.0

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

GetVisibilityTime gets the visibility time stamp

func (*WorkflowTaskTimeoutTask) SetTaskID added in v0.27.0

func (d *WorkflowTaskTimeoutTask) SetTaskID(id int64)

SetTaskID sets the sequence ID.

func (*WorkflowTaskTimeoutTask) SetVersion added in v0.27.0

func (d *WorkflowTaskTimeoutTask) SetVersion(version int64)

SetVersion returns the version of the timer task

func (*WorkflowTaskTimeoutTask) SetVisibilityTimestamp added in v0.27.0

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

SetVisibilityTimestamp gets the visibility time stamp

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() enumsspb.TaskType

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

GetVisibilityTime 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

Directories

Path Synopsis
Package client is a generated GoMock package.
Package client is a generated GoMock package.
sql

Jump to

Keyboard shortcuts

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