Documentation ¶
Index ¶
- Variables
- type ErrHandler
- type ErrorMsg
- type ExecContext
- type InputOption
- type Line
- func (l *Line) AppendStages(stages []*Stage, after ...string) *Line
- func (l *Line) GetStage(stageName string) *Stage
- func (l *Line) Input(obj interface{}, opt ...InputOption)
- func (l *Line) InputAndWait(obj interface{}, opt ...InputOption)
- func (l *Line) IsOpen() bool
- func (l *Line) RemoveStage(stageName string) *Line
- func (l *Line) Run()
- func (l *Line) SetStages(stages []*Stage) *Line
- func (l *Line) Stop() (switched bool)
- func (l *Line) StopAndWait() (switched bool)
- type LineOption
- type M
- type Queue
- type Stage
- type StageOption
- type WorkFunc
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type ErrHandler ¶
type ErrHandler func(msg ErrorMsg)
type ExecContext ¶
type InputOption ¶
type InputOption func(*inputOption)
func WithBatch ¶
func WithBatch() InputOption
WithBatch represents treating the input param as a input slice. Be sure of your input param's kind is SLICE when using this option.
func WithHighestPriority ¶
func WithHighestPriority() InputOption
WithPriority sets priority to the highest.
func WithPriority ¶
func WithPriority(priority uint) InputOption
WithPriority sets priority of the input.
func WithWait ¶
func WithWait() InputOption
WithWait option makes the Input function return after all the input objects been done.
type Line ¶
type Line struct {
// contains filtered or unexported fields
}
func (*Line) AppendStages ¶
AppendStages append stages at specific position. if you don't pass the after param or after param not exist in current line, stages will be appended to the last by default. if after param is empty string, stages will be inserted to the front. When line is running, it'll stop the line firstly and rerun after operation been done.
func (*Line) Input ¶
func (l *Line) Input(obj interface{}, opt ...InputOption)
Input pushes your input object(s) to input queue with giving option.
func (*Line) InputAndWait ¶
func (l *Line) InputAndWait(obj interface{}, opt ...InputOption)
InputAndWait pushes your input object(s) to input queue and wait until all been done.
func (*Line) RemoveStage ¶
RemoveStage remove stage by giving name. When line is running, it'll stop the line firstly and rerun after operation been done.
func (*Line) Run ¶
func (l *Line) Run()
Run starts the line. If the line is already started, it does nothing.
func (*Line) SetStages ¶
SetStages set your stages. When line is running, it'll stop the line firstly and rerun after operation been done.
func (*Line) StopAndWait ¶
StopAndWait stops fetching item from queue and wait until nothing is running.
type LineOption ¶
type LineOption func(*lineOption)
func WithCustomQueue ¶
func WithCustomQueue(q Queue) LineOption
WithCustomQueue sets custom input queue.
func WithMaxQueueLen ¶
func WithMaxQueueLen(max int) LineOption
WithMaxQueueLen sets max length of the input queue. Not effective when using custom queue.
func WithPQSupported ¶
func WithPQSupported() LineOption
WithPQSupported sets priority queue supported.
type Stage ¶
type Stage struct {
// contains filtered or unexported fields
}
func (*Stage) GetWorkerNum ¶
func (*Stage) ResizeWorkerNum ¶
func (*Stage) SetErrHandler ¶
func (s *Stage) SetErrHandler(to ErrHandler)
func (*Stage) SetTimeout ¶
type StageOption ¶
type StageOption func(o *stageOption)
func WithErrHandler ¶
func WithErrHandler(handler ErrHandler) StageOption
func WithTimeout ¶
func WithTimeout(timeout time.Duration) StageOption
func WithWorkerNum ¶
func WithWorkerNum(workerNum int) StageOption