task

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2021 License: MIT Imports: 31 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")
	// ErrTaskRedispatch is the error indicating that the timer / transfer task should be re0dispatched and retried.
	ErrTaskRedispatch = errors.New("passive task should be redispatched due to condition in mutable state is not met")
	// 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 GetOrCreateDomainTaggedScope added in v0.14.0

func GetOrCreateDomainTaggedScope(
	shard shard.Context,
	scopeIdx int,
	domainID string,
	logger log.Logger,
) metrics.Scope

GetOrCreateDomainTaggedScope returns cached domain-tagged metrics scope if exists otherwise, it creates a new domain-tagged scope, cache and return the scope

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 NewMockTaskMatcher added in v0.14.0

func NewMockTaskMatcher(mockTask *MockTask) gomock.Matcher

NewMockTaskMatcher creates a gomock matcher for mock Task

Types

type Executor

type Executor interface {
	Execute(taskInfo Info, shouldProcessTask bool) error
}

Executor contains the execution logic for Task

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,
	metricsClient metrics.Client,
	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,
	metricsClient metrics.Client,
	clusterName string,
	config *config.Config,
) Executor

NewTransferStandbyTaskExecutor creates a new task executor for standby transfer task

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 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(taskInfo Info, 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(taskInfo, shouldProcessTask interface{}) *gomock.Call

Execute indicates an expected call of Execute

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) 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) 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 QueueAckMgr

type QueueAckMgr interface {
	CompleteQueueTask(taskID int64)
}

QueueAckMgr is the interface for acking transfer task

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
)

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,
	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
}

Task is the interface for all tasks generated by history service

func NewTimerTask

func NewTimerTask(
	shard shard.Context,
	taskInfo Info,
	queueType QueueType,
	logger log.Logger,
	taskFilter Filter,
	taskExecutor Executor,
	taskProcessor Processor,
	redispatchFn func(task Task),
	timeSource clock.TimeSource,
	maxRetryCount dynamicconfig.IntPropertyFn,
	ackMgr TimerQueueAckMgr,
) 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),
	timeSource clock.TimeSource,
	maxRetryCount dynamicconfig.IntPropertyFn,
	ackMgr QueueAckMgr,
) Task

NewTransferTask creates a new transfer task

type TimerQueueAckMgr

type TimerQueueAckMgr interface {
	CompleteTimerTask(timerTask *persistence.TimerTaskInfo)
}

TimerQueueAckMgr is the interface for acking timer task

Jump to

Keyboard shortcuts

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