task

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: May 8, 2019 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockSequentialTaskProcessor

type MockSequentialTaskProcessor struct {
	mock.Mock
}

MockSequentialTaskProcessor is an autogenerated mock type for the SequentialTaskProcessor type

func (*MockSequentialTaskProcessor) Start

func (_m *MockSequentialTaskProcessor) Start()

Start provides a mock function with given fields:

func (*MockSequentialTaskProcessor) Stop

func (_m *MockSequentialTaskProcessor) Stop()

Stop provides a mock function with given fields:

func (*MockSequentialTaskProcessor) Submit

Submit provides a mock function with given fields: _a0

type SequentialTask

type SequentialTask interface {
	Task
	SequentialTaskPartitionID
	// TaskID return the ID of the task, this task ID is used for sorting
	TaskID() int64
}

SequentialTask is the interface for tasks which should be executed sequentially one common example is the workflow replication task (containing workflow history), which must be executed one by one, in the order of the first event ID)

type SequentialTaskPartitionID

type SequentialTaskPartitionID interface {
	PartitionID() interface{} // MUST be go primitive type or struct with primitive types
	HashCode() uint32
}

SequentialTaskPartitionID is the interface representing the ID of SequentialTask

type SequentialTaskProcessor

type SequentialTaskProcessor interface {
	common.Daemon
	Submit(task SequentialTask) error
}

SequentialTaskProcessor is the generic goroutines interface which process sequential task for the definition of sequential task, see SequentialTask

func NewSequentialTaskProcessor

func NewSequentialTaskProcessor(coroutineSize int, taskBatchSize int, logger log.Logger) SequentialTaskProcessor

NewSequentialTaskProcessor create a new sequential tasks processor

type SequentialTasks

type SequentialTasks []SequentialTask

SequentialTasks slice of SequentialTask

func (SequentialTasks) Len

func (tasks SequentialTasks) Len() int

func (SequentialTasks) Less

func (tasks SequentialTasks) Less(i, j int) bool

func (SequentialTasks) Swap

func (tasks SequentialTasks) Swap(i, j int)

type Task

type Task interface {
	// Execute process this task
	Execute() error
	// HandleErr handle the error returned by Execute
	HandleErr(err error) error
	// RetryErr check whether to retry after HandleErr(Execute())
	RetryErr(err error) bool
	// Ack marks the task as successful completed
	Ack()
	// Nack marks the task as unsuccessful completed
	Nack()
}

Task is the generic task representation

Jump to

Keyboard shortcuts

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