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: 12 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFunc

func GetFunc(name string) types.FuncInterface

func GetWorker

func GetWorker(name string) types.Worker

func NewFunc

func NewFunc(strategy definition.Strategy) (types.Worker, error)

func NewSimple

func NewSimple(strategy definition.Strategy) (types.Worker, error)

func Register

func Register(worker types.Worker)

Register registers specific type with its full package path as key

func RegisterFunc

func RegisterFunc(name string, fn types.FuncInterface)

RegisterFunc registers func worker into registry which could be fetch through GetFunc(name string)

func RegisterInst

func RegisterInst(worker types.Worker)

RegisterInst registers an instance provided instead of its type

func RegisterInstName

func RegisterInstName(name string, worker types.Worker)

RegisterInstName registers an instance with given name

func RegisterName

func RegisterName(name string, worker types.Worker)

RegisterName registers specific type with specific name as key

Types

type FuncWorker

type FuncWorker struct {
	types.Worker
	// contains filtered or unexported fields
}

FuncWorker uses a func to implement a task loop. A channel is used to do notifications(ping-pong).

func (*FuncWorker) FuncExecutor

func (w *FuncWorker) FuncExecutor(ctx context.Context)

func (*FuncWorker) Start

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

func (*FuncWorker) Stop

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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