tasklist

package
v1.2.14-prerelease13 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: MIT Imports: 37 Imported by: 0

Documentation

Overview

Package tasklist is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoParent            = errors.New("cannot find parent task list for forwarding")
	ErrTaskListKind        = errors.New("forwarding is not supported on sticky task list")
	ErrInvalidTaskListType = errors.New("unrecognized task list type")
	ErrForwarderSlowDown   = errors.New("tasklist forwarding throttle limit exceeded")
)
View Source
var (
	// ErrNoTasks is exported temporarily for integration test
	ErrNoTasks = errors.New("no tasks")
)
View Source
var ErrTasklistThrottled = errors.New("tasklist limit exceeded")

ErrTasklistThrottled implies a tasklist was throttled

Functions

func ContextWithIdentity

func ContextWithIdentity(ctx context.Context, identity string) context.Context

func ContextWithIsolationGroup

func ContextWithIsolationGroup(ctx context.Context, isolationGroup string) context.Context

func ContextWithPollerID

func ContextWithPollerID(ctx context.Context, pollerID string) context.Context

func IdentityFromContext

func IdentityFromContext(ctx context.Context) string

func IsolationGroupFromContext

func IsolationGroupFromContext(ctx context.Context) string

func PollerIDFromContext

func PollerIDFromContext(ctx context.Context) string

Types

type AddTaskParams

type AddTaskParams struct {
	TaskInfo                 *persistence.TaskInfo
	Source                   types.TaskSource
	ForwardedFrom            string
	ActivityTaskDispatchInfo *types.ActivityTaskDispatchInfo
}

type Forwarder

type Forwarder interface {
	ForwardTask(ctx context.Context, task *InternalTask) error
	ForwardQueryTask(ctx context.Context, task *InternalTask) (*types.QueryWorkflowResponse, error)
	ForwardPoll(ctx context.Context) (*InternalTask, error)
	AddReqTokenC() <-chan *ForwarderReqToken
	PollReqTokenC(isolationGroup string) <-chan *ForwarderReqToken
}

type ForwarderReqToken

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

ForwarderReqToken is the token that must be acquired before making forwarder API calls. This type contains the state for the token itself

type Identifier

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

Identifier is the key that uniquely identifies a task list

func NewIdentifier

func NewIdentifier(
	domainID string,
	taskListName string,
	taskType int,
) (*Identifier, error)

NewIdentifier returns identifier which uniquely identifies as task list

func NewTestTaskListID

func NewTestTaskListID(t *testing.T, domainID string, taskListName string, taskType int) *Identifier

func (*Identifier) GetDomainID

func (tid *Identifier) GetDomainID() string

GetDomainID returns the domain ID of the task list

func (*Identifier) GetName

func (tn *Identifier) GetName() string

GetName returns the name of the task list

func (*Identifier) GetRoot

func (tn *Identifier) GetRoot() string

GetRoot returns the root name for a task list

func (*Identifier) GetType

func (tid *Identifier) GetType() int

GetType returns the task type of the task list

func (*Identifier) IsRoot

func (tn *Identifier) IsRoot() bool

IsRoot returns true if this task list is a root partition

func (*Identifier) Parent

func (tn *Identifier) Parent(degree int) string

Parent returns the name of the parent task list input:

degree: Number of children at each level of the tree

Returns empty string if this task list is the root

func (*Identifier) String

func (tid *Identifier) String() string

type InternalTask

type InternalTask struct {
	Event *genericTaskInfo // non-nil for activity or decision task that's locally generated
	Query *queryTaskInfo   // non-nil for a query task that's locally sync matched

	ResponseC                chan error // non-nil only where there is a caller waiting for response (sync-match)
	BacklogCountHint         int64
	ActivityTaskDispatchInfo *types.ActivityTaskDispatchInfo
	// contains filtered or unexported fields
}

InternalTask represents an activity, decision, query or started (received from another host). this struct is more like a union and only one of [ query, event, forwarded ] is non-nil for any given task

func (*InternalTask) Finish

func (task *InternalTask) Finish(err error)

finish marks a task as finished. Should be called after a poller picks up a task and marks it as started. If the task is unable to marked as started, then this method should be called with a non-nil error argument.

func (*InternalTask) Info added in v1.2.13

func (task *InternalTask) Info() persistence.TaskInfo

func (*InternalTask) IsForwarded

func (task *InternalTask) IsForwarded() bool

isForwarded returns true if the underlying task is forwarded by a remote matching host forwarded tasks are already marked as started in history

func (*InternalTask) IsQuery

func (task *InternalTask) IsQuery() bool

isQuery returns true if the underlying task is a query task

func (*InternalTask) IsStarted

func (task *InternalTask) IsStarted() bool

isStarted is true when this task is already marked as started

func (*InternalTask) IsSyncMatch

func (task *InternalTask) IsSyncMatch() bool

func (*InternalTask) PollForActivityResponse

func (task *InternalTask) PollForActivityResponse() *types.MatchingPollForActivityTaskResponse

pollForActivityResponse returns the poll response for an activity task that is already marked as started. This method should only be called when isStarted() is true

func (*InternalTask) PollForDecisionResponse

func (task *InternalTask) PollForDecisionResponse() *types.MatchingPollForDecisionTaskResponse

pollForDecisionResponse returns the poll response for a decision task that is already marked as started. This method should only be called when isStarted() is true

func (*InternalTask) WorkflowExecution

func (task *InternalTask) WorkflowExecution() *types.WorkflowExecution

type Manager

type Manager interface {
	Start() error
	Stop()
	// AddTask adds a task to the task list. This method will first attempt a synchronous
	// match with a poller. When that fails, task will be written to database and later
	// asynchronously matched with a poller
	AddTask(ctx context.Context, params AddTaskParams) (syncMatch bool, err error)
	// GetTask blocks waiting for a task Returns error when context deadline is exceeded
	// maxDispatchPerSecond is the max rate at which tasks are allowed to be dispatched
	// from this task list to pollers
	GetTask(ctx context.Context, maxDispatchPerSecond *float64) (*InternalTask, error)
	// DispatchTask dispatches a task to a poller. When there are no pollers to pick
	// up the task, this method will return error. Task will not be persisted to db
	DispatchTask(ctx context.Context, task *InternalTask) error
	// DispatchQueryTask will dispatch query to local or remote poller. If forwarded then result or error is returned,
	// if dispatched to local poller then nil and nil is returned.
	DispatchQueryTask(ctx context.Context, taskID string, request *types.MatchingQueryWorkflowRequest) (*types.QueryWorkflowResponse, error)
	CancelPoller(pollerID string)
	GetAllPollerInfo() []*types.PollerInfo
	HasPollerAfter(accessTime time.Time) bool
	// DescribeTaskList returns information about the target tasklist
	DescribeTaskList(includeTaskListStatus bool) *types.DescribeTaskListResponse
	String() string
	GetTaskListKind() types.TaskListKind
	TaskListID() *Identifier
	TaskListPartitionConfig() *types.TaskListPartitionConfig
}

func NewManager

func NewManager(
	domainCache cache.DomainCache,
	logger log.Logger,
	metricsClient metrics.Client,
	taskManager persistence.TaskManager,
	clusterMetadata cluster.Metadata,
	partitioner partition.Partitioner,
	matchingClient matching.Client,
	closeCallback func(Manager),
	taskList *Identifier,
	taskListKind *types.TaskListKind,
	config *config.Config,
	timeSource clock.TimeSource,
	createTime time.Time,
) (Manager, error)

type MockForwarder

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

MockForwarder is a mock of Forwarder interface.

func NewMockForwarder

func NewMockForwarder(ctrl *gomock.Controller) *MockForwarder

NewMockForwarder creates a new mock instance.

func (*MockForwarder) AddReqTokenC

func (m *MockForwarder) AddReqTokenC() <-chan *ForwarderReqToken

AddReqTokenC mocks base method.

func (*MockForwarder) EXPECT

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

func (*MockForwarder) ForwardPoll

func (m *MockForwarder) ForwardPoll(ctx context.Context) (*InternalTask, error)

ForwardPoll mocks base method.

func (*MockForwarder) ForwardQueryTask

func (m *MockForwarder) ForwardQueryTask(ctx context.Context, task *InternalTask) (*types.QueryWorkflowResponse, error)

ForwardQueryTask mocks base method.

func (*MockForwarder) ForwardTask

func (m *MockForwarder) ForwardTask(ctx context.Context, task *InternalTask) error

ForwardTask mocks base method.

func (*MockForwarder) PollReqTokenC

func (m *MockForwarder) PollReqTokenC(isolationGroup string) <-chan *ForwarderReqToken

PollReqTokenC mocks base method.

type MockForwarderMockRecorder

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

MockForwarderMockRecorder is the mock recorder for MockForwarder.

func (*MockForwarderMockRecorder) AddReqTokenC

func (mr *MockForwarderMockRecorder) AddReqTokenC() *gomock.Call

AddReqTokenC indicates an expected call of AddReqTokenC.

func (*MockForwarderMockRecorder) ForwardPoll

func (mr *MockForwarderMockRecorder) ForwardPoll(ctx interface{}) *gomock.Call

ForwardPoll indicates an expected call of ForwardPoll.

func (*MockForwarderMockRecorder) ForwardQueryTask

func (mr *MockForwarderMockRecorder) ForwardQueryTask(ctx, task interface{}) *gomock.Call

ForwardQueryTask indicates an expected call of ForwardQueryTask.

func (*MockForwarderMockRecorder) ForwardTask

func (mr *MockForwarderMockRecorder) ForwardTask(ctx, task interface{}) *gomock.Call

ForwardTask indicates an expected call of ForwardTask.

func (*MockForwarderMockRecorder) PollReqTokenC

func (mr *MockForwarderMockRecorder) PollReqTokenC(isolationGroup interface{}) *gomock.Call

PollReqTokenC indicates an expected call of PollReqTokenC.

type MockManager added in v1.2.11

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

MockManager is a mock of Manager interface.

func NewMockManager added in v1.2.11

func NewMockManager(ctrl *gomock.Controller) *MockManager

NewMockManager creates a new mock instance.

func (*MockManager) AddTask added in v1.2.11

func (m *MockManager) AddTask(ctx context.Context, params AddTaskParams) (bool, error)

AddTask mocks base method.

func (*MockManager) CancelPoller added in v1.2.11

func (m *MockManager) CancelPoller(pollerID string)

CancelPoller mocks base method.

func (*MockManager) DescribeTaskList added in v1.2.11

func (m *MockManager) DescribeTaskList(includeTaskListStatus bool) *types.DescribeTaskListResponse

DescribeTaskList mocks base method.

func (*MockManager) DispatchQueryTask added in v1.2.11

func (m *MockManager) DispatchQueryTask(ctx context.Context, taskID string, request *types.MatchingQueryWorkflowRequest) (*types.QueryWorkflowResponse, error)

DispatchQueryTask mocks base method.

func (*MockManager) DispatchTask added in v1.2.11

func (m *MockManager) DispatchTask(ctx context.Context, task *InternalTask) error

DispatchTask mocks base method.

func (*MockManager) EXPECT added in v1.2.11

func (m *MockManager) EXPECT() *MockManagerMockRecorder

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

func (*MockManager) GetAllPollerInfo added in v1.2.11

func (m *MockManager) GetAllPollerInfo() []*types.PollerInfo

GetAllPollerInfo mocks base method.

func (*MockManager) GetTask added in v1.2.11

func (m *MockManager) GetTask(ctx context.Context, maxDispatchPerSecond *float64) (*InternalTask, error)

GetTask mocks base method.

func (*MockManager) GetTaskListKind added in v1.2.11

func (m *MockManager) GetTaskListKind() types.TaskListKind

GetTaskListKind mocks base method.

func (*MockManager) HasPollerAfter added in v1.2.11

func (m *MockManager) HasPollerAfter(accessTime time.Time) bool

HasPollerAfter mocks base method.

func (*MockManager) Start added in v1.2.11

func (m *MockManager) Start() error

Start mocks base method.

func (*MockManager) Stop added in v1.2.11

func (m *MockManager) Stop()

Stop mocks base method.

func (*MockManager) String added in v1.2.11

func (m *MockManager) String() string

String mocks base method.

func (*MockManager) TaskListID added in v1.2.11

func (m *MockManager) TaskListID() *Identifier

TaskListID mocks base method.

func (*MockManager) TaskListPartitionConfig

func (m *MockManager) TaskListPartitionConfig() *types.TaskListPartitionConfig

TaskListPartitionConfig mocks base method.

type MockManagerMockRecorder added in v1.2.11

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

MockManagerMockRecorder is the mock recorder for MockManager.

func (*MockManagerMockRecorder) AddTask added in v1.2.11

func (mr *MockManagerMockRecorder) AddTask(ctx, params interface{}) *gomock.Call

AddTask indicates an expected call of AddTask.

func (*MockManagerMockRecorder) CancelPoller added in v1.2.11

func (mr *MockManagerMockRecorder) CancelPoller(pollerID interface{}) *gomock.Call

CancelPoller indicates an expected call of CancelPoller.

func (*MockManagerMockRecorder) DescribeTaskList added in v1.2.11

func (mr *MockManagerMockRecorder) DescribeTaskList(includeTaskListStatus interface{}) *gomock.Call

DescribeTaskList indicates an expected call of DescribeTaskList.

func (*MockManagerMockRecorder) DispatchQueryTask added in v1.2.11

func (mr *MockManagerMockRecorder) DispatchQueryTask(ctx, taskID, request interface{}) *gomock.Call

DispatchQueryTask indicates an expected call of DispatchQueryTask.

func (*MockManagerMockRecorder) DispatchTask added in v1.2.11

func (mr *MockManagerMockRecorder) DispatchTask(ctx, task interface{}) *gomock.Call

DispatchTask indicates an expected call of DispatchTask.

func (*MockManagerMockRecorder) GetAllPollerInfo added in v1.2.11

func (mr *MockManagerMockRecorder) GetAllPollerInfo() *gomock.Call

GetAllPollerInfo indicates an expected call of GetAllPollerInfo.

func (*MockManagerMockRecorder) GetTask added in v1.2.11

func (mr *MockManagerMockRecorder) GetTask(ctx, maxDispatchPerSecond interface{}) *gomock.Call

GetTask indicates an expected call of GetTask.

func (*MockManagerMockRecorder) GetTaskListKind added in v1.2.11

func (mr *MockManagerMockRecorder) GetTaskListKind() *gomock.Call

GetTaskListKind indicates an expected call of GetTaskListKind.

func (*MockManagerMockRecorder) HasPollerAfter added in v1.2.11

func (mr *MockManagerMockRecorder) HasPollerAfter(accessTime interface{}) *gomock.Call

HasPollerAfter indicates an expected call of HasPollerAfter.

func (*MockManagerMockRecorder) Start added in v1.2.11

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

Start indicates an expected call of Start.

func (*MockManagerMockRecorder) Stop added in v1.2.11

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

Stop indicates an expected call of Stop.

func (*MockManagerMockRecorder) String added in v1.2.11

func (mr *MockManagerMockRecorder) String() *gomock.Call

String indicates an expected call of String.

func (*MockManagerMockRecorder) TaskListID added in v1.2.11

func (mr *MockManagerMockRecorder) TaskListID() *gomock.Call

TaskListID indicates an expected call of TaskListID.

func (*MockManagerMockRecorder) TaskListPartitionConfig

func (mr *MockManagerMockRecorder) TaskListPartitionConfig() *gomock.Call

TaskListPartitionConfig indicates an expected call of TaskListPartitionConfig.

type MockTaskMatcher added in v1.2.14

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

MockTaskMatcher is a mock of TaskMatcher interface.

func NewMockTaskMatcher added in v1.2.14

func NewMockTaskMatcher(ctrl *gomock.Controller) *MockTaskMatcher

NewMockTaskMatcher creates a new mock instance.

func (*MockTaskMatcher) DisconnectBlockedPollers added in v1.2.14

func (m *MockTaskMatcher) DisconnectBlockedPollers()

DisconnectBlockedPollers mocks base method.

func (*MockTaskMatcher) EXPECT added in v1.2.14

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

func (*MockTaskMatcher) MustOffer added in v1.2.14

func (m *MockTaskMatcher) MustOffer(ctx context.Context, task *InternalTask) error

MustOffer mocks base method.

func (*MockTaskMatcher) Offer added in v1.2.14

func (m *MockTaskMatcher) Offer(ctx context.Context, task *InternalTask) (bool, error)

Offer mocks base method.

func (*MockTaskMatcher) OfferOrTimeout added in v1.2.14

func (m *MockTaskMatcher) OfferOrTimeout(ctx context.Context, startT time.Time, task *InternalTask) (bool, error)

OfferOrTimeout mocks base method.

func (*MockTaskMatcher) OfferQuery added in v1.2.14

OfferQuery mocks base method.

func (*MockTaskMatcher) Poll added in v1.2.14

func (m *MockTaskMatcher) Poll(ctx context.Context, isolationGroup string) (*InternalTask, error)

Poll mocks base method.

func (*MockTaskMatcher) PollForQuery added in v1.2.14

func (m *MockTaskMatcher) PollForQuery(ctx context.Context) (*InternalTask, error)

PollForQuery mocks base method.

func (*MockTaskMatcher) Rate added in v1.2.14

func (m *MockTaskMatcher) Rate() float64

Rate mocks base method.

func (*MockTaskMatcher) UpdateRatelimit added in v1.2.14

func (m *MockTaskMatcher) UpdateRatelimit(rps *float64)

UpdateRatelimit mocks base method.

type MockTaskMatcherMockRecorder added in v1.2.14

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

MockTaskMatcherMockRecorder is the mock recorder for MockTaskMatcher.

func (*MockTaskMatcherMockRecorder) DisconnectBlockedPollers added in v1.2.14

func (mr *MockTaskMatcherMockRecorder) DisconnectBlockedPollers() *gomock.Call

DisconnectBlockedPollers indicates an expected call of DisconnectBlockedPollers.

func (*MockTaskMatcherMockRecorder) MustOffer added in v1.2.14

func (mr *MockTaskMatcherMockRecorder) MustOffer(ctx, task interface{}) *gomock.Call

MustOffer indicates an expected call of MustOffer.

func (*MockTaskMatcherMockRecorder) Offer added in v1.2.14

func (mr *MockTaskMatcherMockRecorder) Offer(ctx, task interface{}) *gomock.Call

Offer indicates an expected call of Offer.

func (*MockTaskMatcherMockRecorder) OfferOrTimeout added in v1.2.14

func (mr *MockTaskMatcherMockRecorder) OfferOrTimeout(ctx, startT, task interface{}) *gomock.Call

OfferOrTimeout indicates an expected call of OfferOrTimeout.

func (*MockTaskMatcherMockRecorder) OfferQuery added in v1.2.14

func (mr *MockTaskMatcherMockRecorder) OfferQuery(ctx, task interface{}) *gomock.Call

OfferQuery indicates an expected call of OfferQuery.

func (*MockTaskMatcherMockRecorder) Poll added in v1.2.14

func (mr *MockTaskMatcherMockRecorder) Poll(ctx, isolationGroup interface{}) *gomock.Call

Poll indicates an expected call of Poll.

func (*MockTaskMatcherMockRecorder) PollForQuery added in v1.2.14

func (mr *MockTaskMatcherMockRecorder) PollForQuery(ctx interface{}) *gomock.Call

PollForQuery indicates an expected call of PollForQuery.

func (*MockTaskMatcherMockRecorder) Rate added in v1.2.14

Rate indicates an expected call of Rate.

func (*MockTaskMatcherMockRecorder) UpdateRatelimit added in v1.2.14

func (mr *MockTaskMatcherMockRecorder) UpdateRatelimit(rps interface{}) *gomock.Call

UpdateRatelimit indicates an expected call of UpdateRatelimit.

type TaskMatcher

type TaskMatcher interface {
	DisconnectBlockedPollers()
	Offer(ctx context.Context, task *InternalTask) (bool, error)
	OfferOrTimeout(ctx context.Context, startT time.Time, task *InternalTask) (bool, error)
	OfferQuery(ctx context.Context, task *InternalTask) (*types.QueryWorkflowResponse, error)
	MustOffer(ctx context.Context, task *InternalTask) error
	Poll(ctx context.Context, isolationGroup string) (*InternalTask, error)
	PollForQuery(ctx context.Context) (*InternalTask, error)
	UpdateRatelimit(rps *float64)
	Rate() float64
}

type TestTaskManager

type TestTaskManager struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewTestTaskManager

func NewTestTaskManager(t *testing.T, logger log.Logger, timeSource clock.TimeSource) *TestTaskManager

func (*TestTaskManager) Close

func (m *TestTaskManager) Close()

func (*TestTaskManager) CompleteTask

func (m *TestTaskManager) CompleteTask(
	_ context.Context,
	request *persistence.CompleteTaskRequest,
) error

CompleteTask provides a mock function with given fields: ctx, request

func (*TestTaskManager) CompleteTasksLessThan

CompleteTasksLessThan provides a mock function with given fields: ctx, request

func (*TestTaskManager) CreateTasks

CreateTask provides a mock function with given fields: ctx, request

func (*TestTaskManager) DeleteTaskList

func (m *TestTaskManager) DeleteTaskList(
	_ context.Context,
	request *persistence.DeleteTaskListRequest,
) error

DeleteTaskList provides a mock function with given fields: ctx, request

func (*TestTaskManager) GetCreateTaskCount

func (m *TestTaskManager) GetCreateTaskCount(taskList *Identifier) int

getCreateTaskCount returns how many times CreateTask was called

func (*TestTaskManager) GetName

func (m *TestTaskManager) GetName() string

func (*TestTaskManager) GetOrphanTasks

func (*TestTaskManager) GetRangeID

func (m *TestTaskManager) GetRangeID(taskList *Identifier) int64

func (*TestTaskManager) GetTaskCount

func (m *TestTaskManager) GetTaskCount(taskList *Identifier) int

getTaskCount returns number of tasks in a task list

func (*TestTaskManager) GetTaskList

func (*TestTaskManager) GetTasks

GetTasks provides a mock function with given fields: ctx, request

func (*TestTaskManager) LeaseTaskList

LeaseTaskList provides a mock function with given fields: ctx, request

func (*TestTaskManager) ListTaskList

ListTaskList provides a mock function with given fields: ctx, request

func (*TestTaskManager) SetRangeID

func (m *TestTaskManager) SetRangeID(taskList *Identifier, rangeID int64)

func (*TestTaskManager) String

func (m *TestTaskManager) String() string

func (*TestTaskManager) UpdateTaskList

UpdateTaskList provides a mock function with given fields: ctx, request

Jump to

Keyboard shortcuts

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