Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
func Register(worker Worker)
Register registers specific type with its full package path as key
func RegisterFunc ¶
func RegisterFunc(name string, fn FuncInterface)
RegisterFunc registers func worker into registry which could be fetch through GetFunc(name string)
func RegisterInst ¶
func RegisterInst(worker Worker)
RegisterInst registers an instance provided instead of its type
func RegisterInstName ¶
RegisterInstName registers an instance with given name
func RegisterName ¶
RegisterName registers specific type with specific name as key
Types ¶
type FuncInterface ¶
type FuncInterface func(strategyId, parameter string)
FuncInterface defines the func used in scheduling.
Generally it's better keeping invocation fast but if it costs much more time maybe you should carefully set a suitable timeout during shutdown.
func GetFunc ¶
func GetFunc(name string) FuncInterface
type FuncWorker ¶
type FuncWorker struct { sync.Mutex // TimeoutShutdown is the timeout when waiting to close the worker TimeoutShutdown time.Duration // contains filtered or unexported fields }
FuncWorker uses a func to implement a task loop. A channel is used to do nififications(ping-pong).
func (*FuncWorker) FuncExecutor ¶
func (w *FuncWorker) FuncExecutor()
func (*FuncWorker) NeedStop ¶
func (w *FuncWorker) NeedStop() bool
func (*FuncWorker) Start ¶
func (w *FuncWorker) Start(strategyId, parameter string)
func (*FuncWorker) Stop ¶
func (w *FuncWorker) Stop(strategyId, parameter string)
Click to show internal directories.
Click to hide internal directories.