history

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2020 License: MIT Imports: 64 Imported by: 9

Documentation

Overview

Package history is a generated GoMock package.

Index

Constants

View Source
const (

	// TerminateIfRunningReason reason for terminateIfRunning
	TerminateIfRunningReason = "TerminateIfRunning Policy"
	// TerminateIfRunningDetailsTemplate details template for terminateIfRunning
	TerminateIfRunningDetailsTemplate = "New runID: %s"
)

Variables

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

	// FailedWorkflowCloseState is a set of failed workflow close states, used for start workflow policy
	// for start workflow execution API
	FailedWorkflowCloseState = map[int]bool{
		persistence.WorkflowCloseStatusFailed:     true,
		persistence.WorkflowCloseStatusCanceled:   true,
		persistence.WorkflowCloseStatusTerminated: true,
		persistence.WorkflowCloseStatusTimedOut:   true,
	}
)

Functions

func NewEngineWithShardContext

func NewEngineWithShardContext(
	shard shard.Context,
	visibilityMgr persistence.VisibilityManager,
	matching matching.Client,
	historyClient hc.Client,
	publicClient workflowserviceclient.Interface,
	historyEventNotifier events.Notifier,
	publisher messaging.Producer,
	config *config.Config,
	replicationTaskFetchers replication.TaskFetchers,
	rawMatchingClient matching.Client,
	queueTaskProcessor task.Processor,
	failoverCoordinator failover.Coordinator,
) engine.Engine

NewEngineWithShardContext creates an instance of history engine

func NewService

func NewService(
	params *service.BootstrapParams,
) (resource.Resource, error)

NewService builds a new cadence-history service

Types

type Handler

type Handler struct {
	resource.Resource
	// contains filtered or unexported fields
}

Handler - Thrift handler interface for history service

func NewHandler

func NewHandler(
	resource resource.Resource,
	config *config.Config,
) *Handler

NewHandler creates a thrift handler for the history service

func (*Handler) CloseShard added in v0.9.0

func (h *Handler) CloseShard(
	ctx context.Context,
	request *gen.CloseShardRequest,
) (retError error)

CloseShard closes a shard hosted by this instance

func (*Handler) CreateEngine

func (h *Handler) CreateEngine(
	shardContext shard.Context,
) engine.Engine

CreateEngine is implementation for HistoryEngineFactory used for creating the engine instance for shard

func (*Handler) DescribeHistoryHost added in v0.3.13

func (h *Handler) DescribeHistoryHost(
	ctx context.Context,
	request *gen.DescribeHistoryHostRequest,
) (resp *gen.DescribeHistoryHostResponse, retError error)

DescribeHistoryHost returns information about the internal states of a history host

func (*Handler) DescribeMutableState added in v0.3.13

func (h *Handler) DescribeMutableState(
	ctx context.Context,
	request *hist.DescribeMutableStateRequest,
) (resp *hist.DescribeMutableStateResponse, retError error)

DescribeMutableState - returns the internal analysis of workflow execution state

func (*Handler) DescribeQueue added in v0.15.0

func (h *Handler) DescribeQueue(
	ctx context.Context,
	request *gen.DescribeQueueRequest,
) (resp *gen.DescribeQueueResponse, retError error)

DescribeQueue describes processing queue states

func (*Handler) DescribeWorkflowExecution added in v0.3.3

func (h *Handler) DescribeWorkflowExecution(
	ctx context.Context,
	request *hist.DescribeWorkflowExecutionRequest,
) (resp *gen.DescribeWorkflowExecutionResponse, retError error)

DescribeWorkflowExecution returns information about the specified workflow execution.

func (*Handler) GetDLQReplicationMessages added in v0.12.0

func (h *Handler) GetDLQReplicationMessages(
	ctx context.Context,
	request *r.GetDLQReplicationMessagesRequest,
) (resp *r.GetDLQReplicationMessagesResponse, retError error)

GetDLQReplicationMessages is called by remote peers to get replicated messages for DLQ merging

func (*Handler) GetMutableState added in v0.3.5

func (h *Handler) GetMutableState(
	ctx context.Context,
	getRequest *hist.GetMutableStateRequest,
) (resp *hist.GetMutableStateResponse, retError error)

GetMutableState - returns the id of the next event in the execution's history

func (*Handler) GetReplicationMessages added in v0.9.0

func (h *Handler) GetReplicationMessages(
	ctx context.Context,
	request *r.GetReplicationMessagesRequest,
) (resp *r.GetReplicationMessagesResponse, retError error)

GetReplicationMessages is called by remote peers to get replicated messages for cross DC replication

func (*Handler) Health added in v0.3.0

func (h *Handler) Health(ctx context.Context) (*health.HealthStatus, error)

Health is for health check

func (*Handler) MergeDLQMessages added in v0.12.0

func (h *Handler) MergeDLQMessages(
	ctx context.Context,
	request *r.MergeDLQMessagesRequest,
) (resp *r.MergeDLQMessagesResponse, retError error)

MergeDLQMessages reads and applies replication DLQ messages

func (*Handler) NotifyFailoverMarkers added in v0.14.0

func (h *Handler) NotifyFailoverMarkers(
	ctx context.Context,
	request *hist.NotifyFailoverMarkersRequest,
) (retError error)

NotifyFailoverMarkers sends the failover markers to failover coordinator. The coordinator decides when the failover finishes based on received failover marker.

func (*Handler) PollMutableState added in v0.9.3

func (h *Handler) PollMutableState(
	ctx context.Context,
	getRequest *hist.PollMutableStateRequest,
) (resp *hist.PollMutableStateResponse, retError error)

PollMutableState - returns the id of the next event in the execution's history

func (*Handler) PrepareToStop added in v0.12.0

func (h *Handler) PrepareToStop()

PrepareToStop starts graceful traffic drain in preparation for shutdown

func (*Handler) PurgeDLQMessages added in v0.12.0

func (h *Handler) PurgeDLQMessages(
	ctx context.Context,
	request *r.PurgeDLQMessagesRequest,
) (retError error)

PurgeDLQMessages deletes replication DLQ messages

func (*Handler) QueryWorkflow added in v0.9.0

func (h *Handler) QueryWorkflow(
	ctx context.Context,
	request *hist.QueryWorkflowRequest,
) (resp *hist.QueryWorkflowResponse, retError error)

QueryWorkflow queries a workflow.

func (*Handler) ReadDLQMessages added in v0.12.0

func (h *Handler) ReadDLQMessages(
	ctx context.Context,
	request *r.ReadDLQMessagesRequest,
) (resp *r.ReadDLQMessagesResponse, retError error)

ReadDLQMessages reads replication DLQ messages

func (*Handler) ReapplyEvents added in v0.9.3

func (h *Handler) ReapplyEvents(
	ctx context.Context,
	request *hist.ReapplyEventsRequest,
) (retError error)

ReapplyEvents applies stale events to the current workflow and the current run

func (*Handler) RecordActivityTaskHeartbeat

func (h *Handler) RecordActivityTaskHeartbeat(
	ctx context.Context,
	wrappedRequest *hist.RecordActivityTaskHeartbeatRequest,
) (resp *gen.RecordActivityTaskHeartbeatResponse, retError error)

RecordActivityTaskHeartbeat - Record Activity Task Heart beat.

func (*Handler) RecordActivityTaskStarted

func (h *Handler) RecordActivityTaskStarted(
	ctx context.Context,
	recordRequest *hist.RecordActivityTaskStartedRequest,
) (resp *hist.RecordActivityTaskStartedResponse, retError error)

RecordActivityTaskStarted - Record Activity Task started.

func (*Handler) RecordChildExecutionCompleted

func (h *Handler) RecordChildExecutionCompleted(
	ctx context.Context,
	request *hist.RecordChildExecutionCompletedRequest,
) (retError error)

RecordChildExecutionCompleted is used for reporting the completion of child workflow execution to parent. This is mainly called by transfer queue processor during the processing of DeleteExecution task.

func (*Handler) RecordDecisionTaskStarted

func (h *Handler) RecordDecisionTaskStarted(
	ctx context.Context,
	recordRequest *hist.RecordDecisionTaskStartedRequest,
) (resp *hist.RecordDecisionTaskStartedResponse, retError error)

RecordDecisionTaskStarted - Record Decision Task started.

func (*Handler) RefreshWorkflowTasks added in v0.12.0

func (h *Handler) RefreshWorkflowTasks(
	ctx context.Context,
	request *hist.RefreshWorkflowTasksRequest) (retError error)

RefreshWorkflowTasks refreshes all the tasks of a workflow

func (*Handler) RegisterHandler added in v0.5.8

func (h *Handler) RegisterHandler()

RegisterHandler register this handler, must be called before Start()

func (*Handler) RemoveSignalMutableState added in v0.3.6

func (h *Handler) RemoveSignalMutableState(
	ctx context.Context,
	wrappedRequest *hist.RemoveSignalMutableStateRequest,
) (retError error)

RemoveSignalMutableState is used to remove a signal request ID that was previously recorded. This is currently used to clean execution info when signal decision finished.

func (*Handler) RemoveTask added in v0.9.0

func (h *Handler) RemoveTask(
	ctx context.Context,
	request *gen.RemoveTaskRequest,
) (retError error)

RemoveTask returns information about the internal states of a history host

func (*Handler) ReplicateEvents added in v0.3.11

func (h *Handler) ReplicateEvents(
	ctx context.Context,
	replicateRequest *hist.ReplicateEventsRequest,
) (retError error)

ReplicateEvents is called by processor to replicate history events for passive domains

func (*Handler) ReplicateEventsV2 added in v0.9.3

func (h *Handler) ReplicateEventsV2(
	ctx context.Context,
	replicateRequest *hist.ReplicateEventsV2Request,
) (retError error)

ReplicateEventsV2 is called by processor to replicate history events for passive domains

func (*Handler) ReplicateRawEvents added in v0.5.0

func (h *Handler) ReplicateRawEvents(
	ctx context.Context,
	replicateRequest *hist.ReplicateRawEventsRequest,
) (retError error)

ReplicateRawEvents is called by processor to replicate history raw events for passive domains

func (*Handler) RequestCancelWorkflowExecution

func (h *Handler) RequestCancelWorkflowExecution(
	ctx context.Context,
	request *hist.RequestCancelWorkflowExecutionRequest,
) (retError error)

RequestCancelWorkflowExecution - requests cancellation of a workflow

func (*Handler) ResetQueue added in v0.15.0

func (h *Handler) ResetQueue(
	ctx context.Context,
	request *gen.ResetQueueRequest,
) (retError error)

ResetQueue resets processing queue states

func (*Handler) ResetStickyTaskList added in v0.3.7

func (h *Handler) ResetStickyTaskList(
	ctx context.Context,
	resetRequest *hist.ResetStickyTaskListRequest,
) (resp *hist.ResetStickyTaskListResponse, retError error)

ResetStickyTaskList reset the volatile information in mutable state of a given workflow. Volatile information are the information related to client, such as: 1. StickyTaskList 2. StickyScheduleToStartTimeout 3. ClientLibraryVersion 4. ClientFeatureVersion 5. ClientImpl

func (*Handler) ResetWorkflowExecution added in v0.5.2

func (h *Handler) ResetWorkflowExecution(
	ctx context.Context,
	wrappedRequest *hist.ResetWorkflowExecutionRequest,
) (resp *gen.ResetWorkflowExecutionResponse, retError error)

ResetWorkflowExecution reset an existing workflow execution in the history and immediately terminating the execution instance.

func (*Handler) RespondActivityTaskCanceled

func (h *Handler) RespondActivityTaskCanceled(
	ctx context.Context,
	wrappedRequest *hist.RespondActivityTaskCanceledRequest,
) (retError error)

RespondActivityTaskCanceled - records failure of an activity task

func (*Handler) RespondActivityTaskCompleted

func (h *Handler) RespondActivityTaskCompleted(
	ctx context.Context,
	wrappedRequest *hist.RespondActivityTaskCompletedRequest,
) (retError error)

RespondActivityTaskCompleted - records completion of an activity task

func (*Handler) RespondActivityTaskFailed

func (h *Handler) RespondActivityTaskFailed(
	ctx context.Context,
	wrappedRequest *hist.RespondActivityTaskFailedRequest,
) (retError error)

RespondActivityTaskFailed - records failure of an activity task

func (*Handler) RespondDecisionTaskCompleted

func (h *Handler) RespondDecisionTaskCompleted(
	ctx context.Context,
	wrappedRequest *hist.RespondDecisionTaskCompletedRequest,
) (resp *hist.RespondDecisionTaskCompletedResponse, retError error)

RespondDecisionTaskCompleted - records completion of a decision task

func (*Handler) RespondDecisionTaskFailed added in v0.3.3

func (h *Handler) RespondDecisionTaskFailed(
	ctx context.Context,
	wrappedRequest *hist.RespondDecisionTaskFailedRequest,
) (retError error)

RespondDecisionTaskFailed - failed response to decision task

func (*Handler) ScheduleDecisionTask

func (h *Handler) ScheduleDecisionTask(
	ctx context.Context,
	request *hist.ScheduleDecisionTaskRequest,
) (retError error)

ScheduleDecisionTask is used for creating a decision task for already started workflow execution. This is mainly used by transfer queue processor during the processing of StartChildWorkflowExecution task, where it first starts child execution without creating the decision task and then calls this API after updating the mutable state of parent execution.

func (*Handler) SignalWithStartWorkflowExecution added in v0.3.11

func (h *Handler) SignalWithStartWorkflowExecution(
	ctx context.Context,
	wrappedRequest *hist.SignalWithStartWorkflowExecutionRequest,
) (resp *gen.StartWorkflowExecutionResponse, retError error)

SignalWithStartWorkflowExecution is used to ensure sending a signal event to a workflow execution. If workflow is running, this results in WorkflowExecutionSignaled event recorded in the history and a decision task being created for the execution. If workflow is not running or not found, this results in WorkflowExecutionStarted and WorkflowExecutionSignaled event recorded in history, and a decision task being created for the execution

func (*Handler) SignalWorkflowExecution

func (h *Handler) SignalWorkflowExecution(
	ctx context.Context,
	wrappedRequest *hist.SignalWorkflowExecutionRequest,
) (retError error)

SignalWorkflowExecution is used to send a signal event to running workflow execution. This results in WorkflowExecutionSignaled event recorded in the history and a decision task being created for the execution.

func (*Handler) Start

func (h *Handler) Start()

Start starts the handler

func (*Handler) StartWorkflowExecution

func (h *Handler) StartWorkflowExecution(
	ctx context.Context,
	wrappedRequest *hist.StartWorkflowExecutionRequest,
) (resp *gen.StartWorkflowExecutionResponse, retError error)

StartWorkflowExecution - creates a new workflow execution

func (*Handler) Stop

func (h *Handler) Stop()

Stop stops the handler

func (*Handler) SyncActivity added in v0.4.0

func (h *Handler) SyncActivity(
	ctx context.Context,
	syncActivityRequest *hist.SyncActivityRequest,
) (retError error)

SyncActivity is called by processor to sync activity

func (*Handler) SyncShardStatus added in v0.3.14

func (h *Handler) SyncShardStatus(
	ctx context.Context,
	syncShardStatusRequest *hist.SyncShardStatusRequest,
) (retError error)

SyncShardStatus is called by processor to sync history shard information from another cluster

func (*Handler) TerminateWorkflowExecution

func (h *Handler) TerminateWorkflowExecution(
	ctx context.Context,
	wrappedRequest *hist.TerminateWorkflowExecutionRequest,
) (retError error)

TerminateWorkflowExecution terminates an existing workflow execution by recording WorkflowExecutionTerminated event in the history and immediately terminating the execution instance.

type MockProcessor added in v0.3.12

type MockProcessor struct {
	mock.Mock
}

MockProcessor is used as mock implementation for Processor

type MockQueueAckMgr added in v0.3.12

type MockQueueAckMgr struct {
	mock.Mock
}

MockQueueAckMgr is used as mock implementation for QueueAckMgr

type MockTimerProcessor added in v0.4.0

type MockTimerProcessor struct {
	mock.Mock
}

MockTimerProcessor is used as mock implementation for timerProcessor

type MockTimerQueueAckMgr added in v0.3.11

type MockTimerQueueAckMgr struct {
	mock.Mock
}

MockTimerQueueAckMgr is used as mock implementation for TimerQueueAckMgr

type MockconflictResolver added in v0.11.0

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

MockconflictResolver is a mock of conflictResolver interface

func NewMockconflictResolver added in v0.11.0

func NewMockconflictResolver(ctrl *gomock.Controller) *MockconflictResolver

NewMockconflictResolver creates a new mock instance

func (*MockconflictResolver) EXPECT added in v0.11.0

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

type MockconflictResolverMockRecorder added in v0.11.0

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

MockconflictResolverMockRecorder is the mock recorder for MockconflictResolver

type QueueProcessorOptions added in v0.3.11

type QueueProcessorOptions struct {
	BatchSize                           dynamicconfig.IntPropertyFn
	WorkerCount                         dynamicconfig.IntPropertyFn
	MaxPollRPS                          dynamicconfig.IntPropertyFn
	MaxPollInterval                     dynamicconfig.DurationPropertyFn
	MaxPollIntervalJitterCoefficient    dynamicconfig.FloatPropertyFn
	UpdateAckInterval                   dynamicconfig.DurationPropertyFn
	UpdateAckIntervalJitterCoefficient  dynamicconfig.FloatPropertyFn
	MaxRetryCount                       dynamicconfig.IntPropertyFn
	RedispatchInterval                  dynamicconfig.DurationPropertyFn
	RedispatchIntervalJitterCoefficient dynamicconfig.FloatPropertyFn
	MaxRedispatchQueueSize              dynamicconfig.IntPropertyFn
	EnablePriorityTaskProcessor         dynamicconfig.BoolPropertyFn
	MetricScope                         int
	QueueType                           task.QueueType
}

QueueProcessorOptions is options passed to queue processor implementation

type ReplicatorQueueProcessor added in v0.9.0

type ReplicatorQueueProcessor interface {
	// contains filtered or unexported methods
}

ReplicatorQueueProcessor is the interface for replicator queue processor

type Service

type Service struct {
	resource.Resource
	// contains filtered or unexported fields
}

Service represents the cadence-history service

func (*Service) Start

func (s *Service) Start()

Start starts the service

func (*Service) Stop

func (s *Service) Stop()

Stop stops the service

Directories

Path Synopsis
Package engine is a generated GoMock package.
Package engine is a generated GoMock package.
Package events is a generated GoMock package.
Package events is a generated GoMock package.
Package execution is a generated GoMock package.
Package execution is a generated GoMock package.
Package failover is a generated GoMock package.
Package failover is a generated GoMock package.
Package ndc is a generated GoMock package.
Package ndc is a generated GoMock package.
Package queue is a generated GoMock package.
Package queue is a generated GoMock package.
Package replication is a generated GoMock package.
Package replication is a generated GoMock package.
Package reset is a generated GoMock package.
Package reset is a generated GoMock package.
Package shard is a generated GoMock package.
Package shard is a generated GoMock package.
Package task is a generated GoMock package.
Package task is a generated GoMock package.

Jump to

Keyboard shortcuts

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