task

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: MIT Imports: 32 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")
	// ErrTaskRetry is the error indicating that the timer / transfer task should be retried.
	ErrTaskRetry = errors.New("passive task should retry due to condition in mutable state is not met")
)
View Source
var (
	// ErrMissingRequestCancelInfo indicates missing request cancel info
	ErrMissingRequestCancelInfo = &workflow.InternalServiceError{Message: "unable to get request cancel info"}
	// ErrMissingSignalInfo indicates missing signal external
	ErrMissingSignalInfo = &workflow.InternalServiceError{Message: "unable to get signal info"}
)

Functions

This section is empty.

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,
	queueProcessor common.Daemon,
	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,
	historyRereplicator xdc.HistoryRereplicator,
	nDCHistoryResender xdc.NDCHistoryResender,
	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,
	workflowResetor reset.WorkflowResetor,
	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,
	historyRereplicator xdc.HistoryRereplicator,
	nDCHistoryResender xdc.NDCHistoryResender,
	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 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 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 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,
	scope metrics.Scope,
	logger log.Logger,
	taskFilter Filter,
	taskExecutor Executor,
	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,
	scope metrics.Scope,
	logger log.Logger,
	taskFilter Filter,
	taskExecutor Executor,
	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