task_worker

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2022 License: BSD-3-Clause Imports: 16 Imported by: 1

Documentation

Index

Constants

View Source
const (
	RUNTIME_EMPTY = "<empty>"
)

Variables

This section is empty.

Functions

func NewTask

func NewTask(strategy definition.Strategy, task definition.Task, store store.Store, schedulerId string) (types.Worker, error)

NewTask creates a new task and initials necessary fields

Please don't initial TaskWorker manually

func RegisterTaskInst

func RegisterTaskInst(task types.TaskBase)

RegisterTaskInst registers a task in single instance model with key inferred by its type

func RegisterTaskInstName

func RegisterTaskInstName(name string, task types.TaskBase)

RegisterTaskInstName registers a task in single instance model with given key

func RegisterTaskType

func RegisterTaskType(task types.TaskBase)

RegisterTaskType registers a task type with key inferred by its type

func RegisterTaskTypeName

func RegisterTaskTypeName(name string, task types.TaskBase)

RegisterTaskTypeName registers a task type with key

Types

type BatchExecutor

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

func (*BatchExecutor) ExecuteOrReturn

func (m *BatchExecutor) ExecuteOrReturn() bool

type NormalModel

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

func NewNormalModel

func NewNormalModel(worker *TaskWorker) *NormalModel

func (*NormalModel) LoopOnce

func (m *NormalModel) LoopOnce()

func (*NormalModel) Stop

func (m *NormalModel) Stop()

type SingleExecutor

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

func (*SingleExecutor) ExecuteOrReturn

func (m *SingleExecutor) ExecuteOrReturn() bool

type StreamModel

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

func NewStreamModel

func NewStreamModel(worker *TaskWorker) *StreamModel

func (*StreamModel) LoopOnce

func (m *StreamModel) LoopOnce()

func (*StreamModel) Stop

func (m *StreamModel) Stop()

type TaskExecutor

type TaskExecutor interface {
	// ExecuteOrReturn returns false indicating no element in queue
	ExecuteOrReturn() bool
}

type TaskModel

type TaskModel interface {
	LoopOnce()
	Stop() // called when worker stopping
}

type TaskWorker

type TaskWorker struct {
	types.Worker

	// statistics
	NextBeginTime int64
	Statistics    definition.Statistics
	// contains filtered or unexported fields
}

TaskWorker implements a task-driven worker.

Strategy.Bind should be the identifier of task(on console panel).

func (*TaskWorker) Start

func (w *TaskWorker) Start(strategyId, parameter string) error

func (*TaskWorker) Stop

func (w *TaskWorker) Stop(strategyId, parameter string) error

Jump to

Keyboard shortcuts

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