task

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: MIT Imports: 37 Imported by: 0

Documentation

Overview

Package task is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTaskDiscarded is the error indicating that the timer / transfer task is pending for too long and discarded.
	ErrTaskDiscarded = errors.New("passive task pending for too long")
	// ErrTaskPendingActive is the error indicating that the task should be re-dispatched
	ErrTaskPendingActive = errors.New("redispatch the task while the domain is pending-active")
)
View Source
var (
	// ErrMissingRequestCancelInfo indicates missing request cancel info
	ErrMissingRequestCancelInfo = &types.InternalServiceError{Message: "unable to get request cancel info"}
	// ErrMissingSignalInfo indicates missing signal external
	ErrMissingSignalInfo = &types.InternalServiceError{Message: "unable to get signal info"}
)

Functions

func GetTimerTaskMetricScope added in v0.14.0

func GetTimerTaskMetricScope(
	taskType int,
	isActive bool,
) int

GetTimerTaskMetricScope returns the metrics scope index for timer task

func GetTransferTaskMetricsScope added in v0.14.0

func GetTransferTaskMetricsScope(
	taskType int,
	isActive bool,
) int

GetTransferTaskMetricsScope returns the metrics scope index for transfer task

func InitializeLoggerForTask added in v0.14.0

func InitializeLoggerForTask(
	shardID int,
	task Info,
	logger log.Logger,
) log.Logger

InitializeLoggerForTask creates a new logger with additional tags for task info

func NewCrossClusterTaskProcessors added in v0.23.1

func NewCrossClusterTaskProcessors(
	shard shard.Context,
	taskProcessor Processor,
	taskFetchers Fetchers,
	options *CrossClusterTaskProcessorOptions,
) common.Daemon

NewCrossClusterTaskProcessors creates a list of crossClusterTaskProcessors for processing cross cluster tasks at target cluster. One processor per source cluster per shard

func NewMockTaskMatcher added in v0.14.0

func NewMockTaskMatcher(mockTask *MockTask) gomock.Matcher

NewMockTaskMatcher creates a gomock matcher for mock Task

Types

type CrossClusterTask added in v0.22.0

type CrossClusterTask interface {
	Task

	IsValid() bool
	IsReadyForPoll() bool
	GetCrossClusterRequest() (*types.CrossClusterTaskRequest, error)
	RecordResponse(*types.CrossClusterTaskResponse) error
}

CrossClusterTask is the interface for processing cross cluster task in the source cluster

func NewCrossClusterSourceTask added in v0.23.1

func NewCrossClusterSourceTask(
	shard shard.Context,
	targetCluster string,
	executionCache *execution.Cache,
	taskInfo Info,
	taskExecutor Executor,
	taskProcessor Processor,
	logger log.Logger,
	redispatchFn func(task Task),
	readyForPollFn func(task CrossClusterTask),
	maxRetryCount dynamicconfig.IntPropertyFn,
) CrossClusterTask

NewCrossClusterSourceTask creates a cross cluster task for the processing it at the source cluster

type CrossClusterTaskProcessorOptions added in v0.23.1

type CrossClusterTaskProcessorOptions struct {
	MaxPendingTasks            dynamicconfig.IntPropertyFn
	TaskMaxRetryCount          dynamicconfig.IntPropertyFn
	TaskRedispatchInterval     dynamicconfig.DurationPropertyFn
	TaskWaitInterval           dynamicconfig.DurationPropertyFn
	ServiceBusyBackoffInterval dynamicconfig.DurationPropertyFn
	TimerJitterCoefficient     dynamicconfig.FloatPropertyFn
}

CrossClusterTaskProcessorOptions configures crossClusterTaskProcessor

type Executor

type Executor interface {
	Execute(task Task, shouldProcessTask bool) error
}

Executor contains the execution logic for Task

func NewCrossClusterSourceTaskExecutor added in v0.24.0

func NewCrossClusterSourceTaskExecutor(
	shard shard.Context,
	executionCache *execution.Cache,
	logger log.Logger,
) Executor

func NewCrossClusterTargetTaskExecutor added in v0.23.1

func NewCrossClusterTargetTaskExecutor(
	shard shard.Context,
	logger log.Logger,
	config *config.Config,
) Executor

NewCrossClusterTargetTaskExecutor creates a new task Executor for processing cross cluster tasks at target cluster

func NewTimerActiveTaskExecutor

func NewTimerActiveTaskExecutor(
	shard shard.Context,
	archiverClient archiver.Client,
	executionCache *execution.Cache,
	logger log.Logger,
	metricsClient metrics.Client,
	config *config.Config,
) Executor

NewTimerActiveTaskExecutor creates a new task executor for active timer task

func NewTimerStandbyTaskExecutor

func NewTimerStandbyTaskExecutor(
	shard shard.Context,
	archiverClient archiver.Client,
	executionCache *execution.Cache,
	historyResender ndc.HistoryResender,
	logger log.Logger,
	metricsClient metrics.Client,
	clusterName string,
	config *config.Config,
) Executor

NewTimerStandbyTaskExecutor creates a new task executor for standby timer task

func NewTransferActiveTaskExecutor

func NewTransferActiveTaskExecutor(
	shard shard.Context,
	archiverClient archiver.Client,
	executionCache *execution.Cache,
	workflowResetter reset.WorkflowResetter,
	logger log.Logger,
	config *config.Config,
) Executor

NewTransferActiveTaskExecutor creates a new task executor for active transfer task

func NewTransferStandbyTaskExecutor

func NewTransferStandbyTaskExecutor(
	shard shard.Context,
	archiverClient archiver.Client,
	executionCache *execution.Cache,
	historyResender ndc.HistoryResender,
	logger log.Logger,
	clusterName string,
	config *config.Config,
) Executor

NewTransferStandbyTaskExecutor creates a new task executor for standby transfer task

type Fetcher added in v0.22.0

type Fetcher interface {
	common.Daemon
	GetSourceCluster() string
	Fetch(shardID int, fetchParams ...interface{}) future.Future
}

Fetcher is a host level component for aggregating task fetch requests from all shards on the host and perform one fetching operation for aggregated requests.

type FetcherOptions added in v0.22.0

type FetcherOptions struct {
	Parallelism                dynamicconfig.IntPropertyFn
	AggregationInterval        dynamicconfig.DurationPropertyFn
	ServiceBusyBackoffInterval dynamicconfig.DurationPropertyFn
	ErrorRetryInterval         dynamicconfig.DurationPropertyFn
	TimerJitterCoefficient     dynamicconfig.FloatPropertyFn
}

FetcherOptions configures a Fetcher

type Fetchers added in v0.22.0

type Fetchers []Fetcher

Fetchers is a group of Fetchers, one for each source cluster

func NewCrossClusterTaskFetchers added in v0.22.0

func NewCrossClusterTaskFetchers(
	clusterMetadata cluster.Metadata,
	clientBean client.Bean,
	options *FetcherOptions,
	metricsClient metrics.Client,
	logger log.Logger,
) Fetchers

NewCrossClusterTaskFetchers creates a set of task fetchers, one for each source cluster The future returned by Fetcher.Get() will have value type []*types.CrossClusterTaskRequest

func (Fetchers) Start added in v0.22.0

func (fetchers Fetchers) Start()

Start is a util method for starting a group of fetchers

func (Fetchers) Stop added in v0.22.0

func (fetchers Fetchers) Stop()

Stop is a util method for stopping a group of fetchers

type Filter

type Filter func(task Info) (bool, error)

Filter filters Task

type Info

type Info interface {
	GetVersion() int64
	GetTaskID() int64
	GetTaskType() int
	GetVisibilityTimestamp() time.Time
	GetWorkflowID() string
	GetRunID() string
	GetDomainID() string
}

Info contains the metadata for a task

type Initializer added in v0.14.0

type Initializer func(Info) Task

Initializer initializes a Task based on the Info

type Key

type Key interface {
	Less(Key) bool
}

Key identifies a Task and defines a total order among tasks

type MockCrossClusterTask added in v0.23.1

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

MockCrossClusterTask is a mock of CrossClusterTask interface.

func NewMockCrossClusterTask added in v0.23.1

func NewMockCrossClusterTask(ctrl *gomock.Controller) *MockCrossClusterTask

NewMockCrossClusterTask creates a new mock instance.

func (*MockCrossClusterTask) Ack added in v0.23.1

func (m *MockCrossClusterTask) Ack()

Ack mocks base method.

func (*MockCrossClusterTask) EXPECT added in v0.23.1

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

func (*MockCrossClusterTask) Execute added in v0.23.1

func (m *MockCrossClusterTask) Execute() error

Execute mocks base method.

func (*MockCrossClusterTask) GetAttempt added in v0.23.1

func (m *MockCrossClusterTask) GetAttempt() int

GetAttempt mocks base method.

func (*MockCrossClusterTask) GetCrossClusterRequest added in v0.23.1

func (m *MockCrossClusterTask) GetCrossClusterRequest() (*types.CrossClusterTaskRequest, error)

GetCrossClusterRequest mocks base method.

func (*MockCrossClusterTask) GetDomainID added in v0.23.1

func (m *MockCrossClusterTask) GetDomainID() string

GetDomainID mocks base method.

func (*MockCrossClusterTask) GetInfo added in v0.23.1

func (m *MockCrossClusterTask) GetInfo() Info

GetInfo mocks base method.

func (*MockCrossClusterTask) GetQueueType added in v0.23.1

func (m *MockCrossClusterTask) GetQueueType() QueueType

GetQueueType mocks base method.

func (*MockCrossClusterTask) GetRunID added in v0.23.1

func (m *MockCrossClusterTask) GetRunID() string

GetRunID mocks base method.

func (*MockCrossClusterTask) GetShard added in v0.23.1

func (m *MockCrossClusterTask) GetShard() shard.Context

GetShard mocks base method.

func (*MockCrossClusterTask) GetTaskID added in v0.23.1

func (m *MockCrossClusterTask) GetTaskID() int64

GetTaskID mocks base method.

func (*MockCrossClusterTask) GetTaskType added in v0.23.1

func (m *MockCrossClusterTask) GetTaskType() int

GetTaskType mocks base method.

func (*MockCrossClusterTask) GetVersion added in v0.23.1

func (m *MockCrossClusterTask) GetVersion() int64

GetVersion mocks base method.

func (*MockCrossClusterTask) GetVisibilityTimestamp added in v0.23.1

func (m *MockCrossClusterTask) GetVisibilityTimestamp() time.Time

GetVisibilityTimestamp mocks base method.

func (*MockCrossClusterTask) GetWorkflowID added in v0.23.1

func (m *MockCrossClusterTask) GetWorkflowID() string

GetWorkflowID mocks base method.

func (*MockCrossClusterTask) HandleErr added in v0.23.1

func (m *MockCrossClusterTask) HandleErr(err error) error

HandleErr mocks base method.

func (*MockCrossClusterTask) IsReadyForPoll added in v0.23.1

func (m *MockCrossClusterTask) IsReadyForPoll() bool

IsReadyForPoll mocks base method.

func (*MockCrossClusterTask) IsValid added in v0.23.1

func (m *MockCrossClusterTask) IsValid() bool

IsValid mocks base method.

func (*MockCrossClusterTask) Nack added in v0.23.1

func (m *MockCrossClusterTask) Nack()

Nack mocks base method.

func (*MockCrossClusterTask) Priority added in v0.23.1

func (m *MockCrossClusterTask) Priority() int

Priority mocks base method.

func (*MockCrossClusterTask) RecordResponse added in v0.24.0

func (m *MockCrossClusterTask) RecordResponse(arg0 *types.CrossClusterTaskResponse) error

RecordResponse mocks base method.

func (*MockCrossClusterTask) RetryErr added in v0.23.1

func (m *MockCrossClusterTask) RetryErr(err error) bool

RetryErr mocks base method.

func (*MockCrossClusterTask) SetPriority added in v0.23.1

func (m *MockCrossClusterTask) SetPriority(arg0 int)

SetPriority mocks base method.

func (*MockCrossClusterTask) State added in v0.23.1

func (m *MockCrossClusterTask) State() task.State

State mocks base method.

type MockCrossClusterTaskMockRecorder added in v0.23.1

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

MockCrossClusterTaskMockRecorder is the mock recorder for MockCrossClusterTask.

func (*MockCrossClusterTaskMockRecorder) Ack added in v0.23.1

Ack indicates an expected call of Ack.

func (*MockCrossClusterTaskMockRecorder) Execute added in v0.23.1

Execute indicates an expected call of Execute.

func (*MockCrossClusterTaskMockRecorder) GetAttempt added in v0.23.1

func (mr *MockCrossClusterTaskMockRecorder) GetAttempt() *gomock.Call

GetAttempt indicates an expected call of GetAttempt.

func (*MockCrossClusterTaskMockRecorder) GetCrossClusterRequest added in v0.23.1

func (mr *MockCrossClusterTaskMockRecorder) GetCrossClusterRequest() *gomock.Call

GetCrossClusterRequest indicates an expected call of GetCrossClusterRequest.

func (*MockCrossClusterTaskMockRecorder) GetDomainID added in v0.23.1

func (mr *MockCrossClusterTaskMockRecorder) GetDomainID() *gomock.Call

GetDomainID indicates an expected call of GetDomainID.

func (*MockCrossClusterTaskMockRecorder) GetInfo added in v0.23.1

GetInfo indicates an expected call of GetInfo.

func (*MockCrossClusterTaskMockRecorder) GetQueueType added in v0.23.1

func (mr *MockCrossClusterTaskMockRecorder) GetQueueType() *gomock.Call

GetQueueType indicates an expected call of GetQueueType.

func (*MockCrossClusterTaskMockRecorder) GetRunID added in v0.23.1

GetRunID indicates an expected call of GetRunID.

func (*MockCrossClusterTaskMockRecorder) GetShard added in v0.23.1

GetShard indicates an expected call of GetShard.

func (*MockCrossClusterTaskMockRecorder) GetTaskID added in v0.23.1

func (mr *MockCrossClusterTaskMockRecorder) GetTaskID() *gomock.Call

GetTaskID indicates an expected call of GetTaskID.

func (*MockCrossClusterTaskMockRecorder) GetTaskType added in v0.23.1

func (mr *MockCrossClusterTaskMockRecorder) GetTaskType() *gomock.Call

GetTaskType indicates an expected call of GetTaskType.

func (*MockCrossClusterTaskMockRecorder) GetVersion added in v0.23.1

func (mr *MockCrossClusterTaskMockRecorder) GetVersion() *gomock.Call

GetVersion indicates an expected call of GetVersion.

func (*MockCrossClusterTaskMockRecorder) GetVisibilityTimestamp added in v0.23.1

func (mr *MockCrossClusterTaskMockRecorder) GetVisibilityTimestamp() *gomock.Call

GetVisibilityTimestamp indicates an expected call of GetVisibilityTimestamp.

func (*MockCrossClusterTaskMockRecorder) GetWorkflowID added in v0.23.1

func (mr *MockCrossClusterTaskMockRecorder) GetWorkflowID() *gomock.Call

GetWorkflowID indicates an expected call of GetWorkflowID.

func (*MockCrossClusterTaskMockRecorder) HandleErr added in v0.23.1

func (mr *MockCrossClusterTaskMockRecorder) HandleErr(err interface{}) *gomock.Call

HandleErr indicates an expected call of HandleErr.

func (*MockCrossClusterTaskMockRecorder) IsReadyForPoll added in v0.23.1

func (mr *MockCrossClusterTaskMockRecorder) IsReadyForPoll() *gomock.Call

IsReadyForPoll indicates an expected call of IsReadyForPoll.

func (*MockCrossClusterTaskMockRecorder) IsValid added in v0.23.1

IsValid indicates an expected call of IsValid.

func (*MockCrossClusterTaskMockRecorder) Nack added in v0.23.1

Nack indicates an expected call of Nack.

func (*MockCrossClusterTaskMockRecorder) Priority added in v0.23.1

Priority indicates an expected call of Priority.

func (*MockCrossClusterTaskMockRecorder) RecordResponse added in v0.24.0

func (mr *MockCrossClusterTaskMockRecorder) RecordResponse(arg0 interface{}) *gomock.Call

RecordResponse indicates an expected call of RecordResponse.

func (*MockCrossClusterTaskMockRecorder) RetryErr added in v0.23.1

func (mr *MockCrossClusterTaskMockRecorder) RetryErr(err interface{}) *gomock.Call

RetryErr indicates an expected call of RetryErr.

func (*MockCrossClusterTaskMockRecorder) SetPriority added in v0.23.1

func (mr *MockCrossClusterTaskMockRecorder) SetPriority(arg0 interface{}) *gomock.Call

SetPriority indicates an expected call of SetPriority.

func (*MockCrossClusterTaskMockRecorder) State added in v0.23.1

State indicates an expected call of State.

type MockExecutor

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

MockExecutor is a mock of Executor interface.

func NewMockExecutor

func NewMockExecutor(ctrl *gomock.Controller) *MockExecutor

NewMockExecutor creates a new mock instance.

func (*MockExecutor) EXPECT

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

func (*MockExecutor) Execute

func (m *MockExecutor) Execute(task Task, shouldProcessTask bool) error

Execute mocks base method.

type MockExecutorMockRecorder

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

MockExecutorMockRecorder is the mock recorder for MockExecutor.

func (*MockExecutorMockRecorder) Execute

func (mr *MockExecutorMockRecorder) Execute(task, shouldProcessTask interface{}) *gomock.Call

Execute indicates an expected call of Execute.

type MockFetcher added in v0.22.0

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

MockFetcher is a mock of Fetcher interface.

func NewMockFetcher added in v0.22.0

func NewMockFetcher(ctrl *gomock.Controller) *MockFetcher

NewMockFetcher creates a new mock instance.

func (*MockFetcher) EXPECT added in v0.22.0

func (m *MockFetcher) EXPECT() *MockFetcherMockRecorder

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

func (*MockFetcher) Fetch added in v0.22.0

func (m *MockFetcher) Fetch(shardID int, fetchParams ...interface{}) future.Future

Fetch mocks base method.

func (*MockFetcher) GetSourceCluster added in v0.22.0

func (m *MockFetcher) GetSourceCluster() string

GetSourceCluster mocks base method.

func (*MockFetcher) Start added in v0.22.0

func (m *MockFetcher) Start()

Start mocks base method.

func (*MockFetcher) Stop added in v0.22.0

func (m *MockFetcher) Stop()

Stop mocks base method.

type MockFetcherMockRecorder added in v0.22.0

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

MockFetcherMockRecorder is the mock recorder for MockFetcher.

func (*MockFetcherMockRecorder) Fetch added in v0.22.0

func (mr *MockFetcherMockRecorder) Fetch(shardID interface{}, fetchParams ...interface{}) *gomock.Call

Fetch indicates an expected call of Fetch.

func (*MockFetcherMockRecorder) GetSourceCluster added in v0.22.0

func (mr *MockFetcherMockRecorder) GetSourceCluster() *gomock.Call

GetSourceCluster indicates an expected call of GetSourceCluster.

func (*MockFetcherMockRecorder) Start added in v0.22.0

func (mr *MockFetcherMockRecorder) Start() *gomock.Call

Start indicates an expected call of Start.

func (*MockFetcherMockRecorder) Stop added in v0.22.0

func (mr *MockFetcherMockRecorder) Stop() *gomock.Call

Stop indicates an expected call of Stop.

type MockInfo

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

MockInfo is a mock of Info interface.

func NewMockInfo

func NewMockInfo(ctrl *gomock.Controller) *MockInfo

NewMockInfo creates a new mock instance.

func (*MockInfo) EXPECT

func (m *MockInfo) EXPECT() *MockInfoMockRecorder

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

func (*MockInfo) GetDomainID

func (m *MockInfo) GetDomainID() string

GetDomainID mocks base method.

func (*MockInfo) GetRunID

func (m *MockInfo) GetRunID() string

GetRunID mocks base method.

func (*MockInfo) GetTaskID

func (m *MockInfo) GetTaskID() int64

GetTaskID mocks base method.

func (*MockInfo) GetTaskType

func (m *MockInfo) GetTaskType() int

GetTaskType mocks base method.

func (*MockInfo) GetVersion

func (m *MockInfo) GetVersion() int64

GetVersion mocks base method.

func (*MockInfo) GetVisibilityTimestamp

func (m *MockInfo) GetVisibilityTimestamp() time.Time

GetVisibilityTimestamp mocks base method.

func (*MockInfo) GetWorkflowID

func (m *MockInfo) GetWorkflowID() string

GetWorkflowID mocks base method.

type MockInfoMockRecorder

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

MockInfoMockRecorder is the mock recorder for MockInfo.

func (*MockInfoMockRecorder) GetDomainID

func (mr *MockInfoMockRecorder) GetDomainID() *gomock.Call

GetDomainID indicates an expected call of GetDomainID.

func (*MockInfoMockRecorder) GetRunID

func (mr *MockInfoMockRecorder) GetRunID() *gomock.Call

GetRunID indicates an expected call of GetRunID.

func (*MockInfoMockRecorder) GetTaskID

func (mr *MockInfoMockRecorder) GetTaskID() *gomock.Call

GetTaskID indicates an expected call of GetTaskID.

func (*MockInfoMockRecorder) GetTaskType

func (mr *MockInfoMockRecorder) GetTaskType() *gomock.Call

GetTaskType indicates an expected call of GetTaskType.

func (*MockInfoMockRecorder) GetVersion

func (mr *MockInfoMockRecorder) GetVersion() *gomock.Call

GetVersion indicates an expected call of GetVersion.

func (*MockInfoMockRecorder) GetVisibilityTimestamp

func (mr *MockInfoMockRecorder) GetVisibilityTimestamp() *gomock.Call

GetVisibilityTimestamp indicates an expected call of GetVisibilityTimestamp.

func (*MockInfoMockRecorder) GetWorkflowID

func (mr *MockInfoMockRecorder) GetWorkflowID() *gomock.Call

GetWorkflowID indicates an expected call of GetWorkflowID.

type MockKey

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

MockKey is a mock of Key interface.

func NewMockKey

func NewMockKey(ctrl *gomock.Controller) *MockKey

NewMockKey creates a new mock instance.

func (*MockKey) EXPECT

func (m *MockKey) EXPECT() *MockKeyMockRecorder

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

func (*MockKey) Less

func (m *MockKey) Less(arg0 Key) bool

Less mocks base method.

type MockKeyMockRecorder

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

MockKeyMockRecorder is the mock recorder for MockKey.

func (*MockKeyMockRecorder) Less

func (mr *MockKeyMockRecorder) Less(arg0 interface{}) *gomock.Call

Less indicates an expected call of Less.

type MockPriorityAssigner

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

MockPriorityAssigner is a mock of PriorityAssigner interface.

func NewMockPriorityAssigner

func NewMockPriorityAssigner(ctrl *gomock.Controller) *MockPriorityAssigner

NewMockPriorityAssigner creates a new mock instance.

func (*MockPriorityAssigner) Assign

func (m *MockPriorityAssigner) Assign(arg0 Task) error

Assign mocks base method.

func (*MockPriorityAssigner) EXPECT

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

type MockPriorityAssignerMockRecorder

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

MockPriorityAssignerMockRecorder is the mock recorder for MockPriorityAssigner.

func (*MockPriorityAssignerMockRecorder) Assign

func (mr *MockPriorityAssignerMockRecorder) Assign(arg0 interface{}) *gomock.Call

Assign indicates an expected call of Assign.

type MockProcessor

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

MockProcessor is a mock of Processor interface.

func NewMockProcessor

func NewMockProcessor(ctrl *gomock.Controller) *MockProcessor

NewMockProcessor creates a new mock instance.

func (*MockProcessor) EXPECT

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

func (*MockProcessor) Start

func (m *MockProcessor) Start()

Start mocks base method.

func (*MockProcessor) Stop

func (m *MockProcessor) Stop()

Stop mocks base method.

func (*MockProcessor) StopShardProcessor

func (m *MockProcessor) StopShardProcessor(arg0 shard.Context)

StopShardProcessor mocks base method.

func (*MockProcessor) Submit

func (m *MockProcessor) Submit(arg0 Task) error

Submit mocks base method.

func (*MockProcessor) TrySubmit

func (m *MockProcessor) TrySubmit(arg0 Task) (bool, error)

TrySubmit mocks base method.

type MockProcessorMockRecorder

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

MockProcessorMockRecorder is the mock recorder for MockProcessor.

func (*MockProcessorMockRecorder) Start

func (mr *MockProcessorMockRecorder) Start() *gomock.Call

Start indicates an expected call of Start.

func (*MockProcessorMockRecorder) Stop

Stop indicates an expected call of Stop.

func (*MockProcessorMockRecorder) StopShardProcessor

func (mr *MockProcessorMockRecorder) StopShardProcessor(arg0 interface{}) *gomock.Call

StopShardProcessor indicates an expected call of StopShardProcessor.

func (*MockProcessorMockRecorder) Submit

func (mr *MockProcessorMockRecorder) Submit(arg0 interface{}) *gomock.Call

Submit indicates an expected call of Submit.

func (*MockProcessorMockRecorder) TrySubmit

func (mr *MockProcessorMockRecorder) TrySubmit(arg0 interface{}) *gomock.Call

TrySubmit indicates an expected call of TrySubmit.

type MockRedispatcher added in v0.14.0

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

MockRedispatcher is a mock of Redispatcher interface.

func NewMockRedispatcher added in v0.14.0

func NewMockRedispatcher(ctrl *gomock.Controller) *MockRedispatcher

NewMockRedispatcher creates a new mock instance.

func (*MockRedispatcher) AddTask added in v0.14.0

func (m *MockRedispatcher) AddTask(arg0 Task)

AddTask mocks base method.

func (*MockRedispatcher) EXPECT added in v0.14.0

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

func (*MockRedispatcher) Redispatch added in v0.14.0

func (m *MockRedispatcher) Redispatch(targetSize int)

Redispatch mocks base method.

func (*MockRedispatcher) Size added in v0.14.0

func (m *MockRedispatcher) Size() int

Size mocks base method.

func (*MockRedispatcher) Start added in v0.14.0

func (m *MockRedispatcher) Start()

Start mocks base method.

func (*MockRedispatcher) Stop added in v0.14.0

func (m *MockRedispatcher) Stop()

Stop mocks base method.

type MockRedispatcherMockRecorder added in v0.14.0

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

MockRedispatcherMockRecorder is the mock recorder for MockRedispatcher.

func (*MockRedispatcherMockRecorder) AddTask added in v0.14.0

func (mr *MockRedispatcherMockRecorder) AddTask(arg0 interface{}) *gomock.Call

AddTask indicates an expected call of AddTask.

func (*MockRedispatcherMockRecorder) Redispatch added in v0.14.0

func (mr *MockRedispatcherMockRecorder) Redispatch(targetSize interface{}) *gomock.Call

Redispatch indicates an expected call of Redispatch.

func (*MockRedispatcherMockRecorder) Size added in v0.14.0

Size indicates an expected call of Size.

func (*MockRedispatcherMockRecorder) Start added in v0.14.0

Start indicates an expected call of Start.

func (*MockRedispatcherMockRecorder) Stop added in v0.14.0

Stop indicates an expected call of Stop.

type MockTask

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

MockTask is a mock of Task interface.

func NewMockTask

func NewMockTask(ctrl *gomock.Controller) *MockTask

NewMockTask creates a new mock instance.

func (*MockTask) Ack

func (m *MockTask) Ack()

Ack mocks base method.

func (*MockTask) EXPECT

func (m *MockTask) EXPECT() *MockTaskMockRecorder

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

func (*MockTask) Execute

func (m *MockTask) Execute() error

Execute mocks base method.

func (*MockTask) GetAttempt

func (m *MockTask) GetAttempt() int

GetAttempt mocks base method.

func (*MockTask) GetDomainID

func (m *MockTask) GetDomainID() string

GetDomainID mocks base method.

func (*MockTask) GetInfo added in v0.23.1

func (m *MockTask) GetInfo() Info

GetInfo mocks base method.

func (*MockTask) GetQueueType

func (m *MockTask) GetQueueType() QueueType

GetQueueType mocks base method.

func (*MockTask) GetRunID

func (m *MockTask) GetRunID() string

GetRunID mocks base method.

func (*MockTask) GetShard

func (m *MockTask) GetShard() shard.Context

GetShard mocks base method.

func (*MockTask) GetTaskID

func (m *MockTask) GetTaskID() int64

GetTaskID mocks base method.

func (*MockTask) GetTaskType

func (m *MockTask) GetTaskType() int

GetTaskType mocks base method.

func (*MockTask) GetVersion

func (m *MockTask) GetVersion() int64

GetVersion mocks base method.

func (*MockTask) GetVisibilityTimestamp

func (m *MockTask) GetVisibilityTimestamp() time.Time

GetVisibilityTimestamp mocks base method.

func (*MockTask) GetWorkflowID

func (m *MockTask) GetWorkflowID() string

GetWorkflowID mocks base method.

func (*MockTask) HandleErr

func (m *MockTask) HandleErr(err error) error

HandleErr mocks base method.

func (*MockTask) Nack

func (m *MockTask) Nack()

Nack mocks base method.

func (*MockTask) Priority

func (m *MockTask) Priority() int

Priority mocks base method.

func (*MockTask) RetryErr

func (m *MockTask) RetryErr(err error) bool

RetryErr mocks base method.

func (*MockTask) SetPriority

func (m *MockTask) SetPriority(arg0 int)

SetPriority mocks base method.

func (*MockTask) State

func (m *MockTask) State() task.State

State mocks base method.

type MockTaskMockRecorder

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

MockTaskMockRecorder is the mock recorder for MockTask.

func (*MockTaskMockRecorder) Ack

func (mr *MockTaskMockRecorder) Ack() *gomock.Call

Ack indicates an expected call of Ack.

func (*MockTaskMockRecorder) Execute

func (mr *MockTaskMockRecorder) Execute() *gomock.Call

Execute indicates an expected call of Execute.

func (*MockTaskMockRecorder) GetAttempt

func (mr *MockTaskMockRecorder) GetAttempt() *gomock.Call

GetAttempt indicates an expected call of GetAttempt.

func (*MockTaskMockRecorder) GetDomainID

func (mr *MockTaskMockRecorder) GetDomainID() *gomock.Call

GetDomainID indicates an expected call of GetDomainID.

func (*MockTaskMockRecorder) GetInfo added in v0.23.1

func (mr *MockTaskMockRecorder) GetInfo() *gomock.Call

GetInfo indicates an expected call of GetInfo.

func (*MockTaskMockRecorder) GetQueueType

func (mr *MockTaskMockRecorder) GetQueueType() *gomock.Call

GetQueueType indicates an expected call of GetQueueType.

func (*MockTaskMockRecorder) GetRunID

func (mr *MockTaskMockRecorder) GetRunID() *gomock.Call

GetRunID indicates an expected call of GetRunID.

func (*MockTaskMockRecorder) GetShard

func (mr *MockTaskMockRecorder) GetShard() *gomock.Call

GetShard indicates an expected call of GetShard.

func (*MockTaskMockRecorder) GetTaskID

func (mr *MockTaskMockRecorder) GetTaskID() *gomock.Call

GetTaskID indicates an expected call of GetTaskID.

func (*MockTaskMockRecorder) GetTaskType

func (mr *MockTaskMockRecorder) GetTaskType() *gomock.Call

GetTaskType indicates an expected call of GetTaskType.

func (*MockTaskMockRecorder) GetVersion

func (mr *MockTaskMockRecorder) GetVersion() *gomock.Call

GetVersion indicates an expected call of GetVersion.

func (*MockTaskMockRecorder) GetVisibilityTimestamp

func (mr *MockTaskMockRecorder) GetVisibilityTimestamp() *gomock.Call

GetVisibilityTimestamp indicates an expected call of GetVisibilityTimestamp.

func (*MockTaskMockRecorder) GetWorkflowID

func (mr *MockTaskMockRecorder) GetWorkflowID() *gomock.Call

GetWorkflowID indicates an expected call of GetWorkflowID.

func (*MockTaskMockRecorder) HandleErr

func (mr *MockTaskMockRecorder) HandleErr(err interface{}) *gomock.Call

HandleErr indicates an expected call of HandleErr.

func (*MockTaskMockRecorder) Nack

func (mr *MockTaskMockRecorder) Nack() *gomock.Call

Nack indicates an expected call of Nack.

func (*MockTaskMockRecorder) Priority

func (mr *MockTaskMockRecorder) Priority() *gomock.Call

Priority indicates an expected call of Priority.

func (*MockTaskMockRecorder) RetryErr

func (mr *MockTaskMockRecorder) RetryErr(err interface{}) *gomock.Call

RetryErr indicates an expected call of RetryErr.

func (*MockTaskMockRecorder) SetPriority

func (mr *MockTaskMockRecorder) SetPriority(arg0 interface{}) *gomock.Call

SetPriority indicates an expected call of SetPriority.

func (*MockTaskMockRecorder) State

func (mr *MockTaskMockRecorder) State() *gomock.Call

State indicates an expected call of State.

type PriorityAssigner

type PriorityAssigner interface {
	Assign(Task) error
}

PriorityAssigner assigns priority to Tasks

func NewPriorityAssigner

func NewPriorityAssigner(
	currentClusterName string,
	domainCache cache.DomainCache,
	logger log.Logger,
	metricClient metrics.Client,
	config *config.Config,
) PriorityAssigner

NewPriorityAssigner creates a new task priority assigner

type Processor

type Processor interface {
	common.Daemon
	StopShardProcessor(shard.Context)
	Submit(Task) error
	TrySubmit(Task) (bool, error)
}

Processor is the worker pool for processing Tasks

func NewProcessor

func NewProcessor(
	priorityAssigner PriorityAssigner,
	config *config.Config,
	logger log.Logger,
	metricsClient metrics.Client,
) (Processor, error)

NewProcessor creates a new task processor

type QueueType

type QueueType int

QueueType is the type of task queue

const (
	// QueueTypeActiveTransfer is the queue type for active transfer queue processor
	QueueTypeActiveTransfer QueueType = iota + 1
	// QueueTypeStandbyTransfer is the queue type for standby transfer queue processor
	QueueTypeStandbyTransfer
	// QueueTypeActiveTimer is the queue type for active timer queue processor
	QueueTypeActiveTimer
	// QueueTypeStandbyTimer is the queue type for standby timer queue processor
	QueueTypeStandbyTimer
	// QueueTypeReplication is the queue type for replication queue processor
	QueueTypeReplication
	// QueueTypeCrossCluster is the queue type for cross cluster queue processor
	QueueTypeCrossCluster
)

type Redispatcher added in v0.14.0

type Redispatcher interface {
	common.Daemon
	AddTask(Task)
	Redispatch(targetSize int)
	Size() int
}

Redispatcher buffers tasks and periodically redispatch them to Processor redispatch can also be triggered immediately by calling the Redispatch method

func NewRedispatcher added in v0.14.0

func NewRedispatcher(
	taskProcessor Processor,
	timeSource clock.TimeSource,
	options *RedispatcherOptions,
	logger log.Logger,
	metricsScope metrics.Scope,
) Redispatcher

NewRedispatcher creates a new task Redispatcher

type RedispatcherOptions added in v0.14.0

type RedispatcherOptions struct {
	TaskRedispatchInterval                  dynamicconfig.DurationPropertyFn
	TaskRedispatchIntervalJitterCoefficient dynamicconfig.FloatPropertyFn
}

RedispatcherOptions configs redispatch interval

type Task

type Task interface {
	task.PriorityTask
	Info
	GetQueueType() QueueType
	GetShard() shard.Context
	GetAttempt() int
	GetInfo() Info
}

Task is the interface for all tasks generated by history service

func NewCrossClusterTargetTask added in v0.23.1

func NewCrossClusterTargetTask(
	shard shard.Context,
	taskRequest *types.CrossClusterTaskRequest,
	taskExecutor Executor,
	taskProcessor Processor,
	logger log.Logger,
	redispatchFn func(task Task),
	maxRetryCount dynamicconfig.IntPropertyFn,
) (Task, future.Future)

NewCrossClusterTargetTask is called at the target cluster to process the cross cluster task the returned the Future will be unblocked after the task is processed. The future value has type types.CrossClusterTaskResponse and there won't be any error returned for this future. All errors will be recorded by the FailedCause field in the response.

func NewTimerTask

func NewTimerTask(
	shard shard.Context,
	taskInfo Info,
	queueType QueueType,
	logger log.Logger,
	taskFilter Filter,
	taskExecutor Executor,
	taskProcessor Processor,
	redispatchFn func(task Task),
	criticalRetryCount dynamicconfig.IntPropertyFn,
) Task

NewTimerTask creates a new timer task

func NewTransferTask

func NewTransferTask(
	shard shard.Context,
	taskInfo Info,
	queueType QueueType,
	logger log.Logger,
	taskFilter Filter,
	taskExecutor Executor,
	taskProcessor Processor,
	redispatchFn func(task Task),
	criticalRetryCount dynamicconfig.IntPropertyFn,
) Task

NewTransferTask creates a new transfer task

Jump to

Keyboard shortcuts

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