Documentation
¶
Index ¶
- Constants
- type Condition
- type Executor
- type Static
- type Subflow
- type Task
- type TaskFlow
- func (tf *TaskFlow) Dump(writer io.Writer) error
- func (tf *TaskFlow) Name() string
- func (tf *TaskFlow) NewCondition(name string, predict func() uint) *Task
- func (tf *TaskFlow) NewSubflow(name string, instantiate func(sf *Subflow)) *Task
- func (tf *TaskFlow) NewTask(name string, f func()) *Task
- func (tf *TaskFlow) Reset()
- type TaskPriority
- type Visualizer
Constants ¶
const ( HIGH = TaskPriority(iota + 1) NORMAL LOW )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Condition ¶ added in v0.0.5
type Condition struct {
// contains filtered or unexported fields
}
Condition Wrapper
type Executor ¶
type Executor interface { Wait() // Wait block until all tasks finished Profile(w io.Writer) error // Profile write flame graph raw text into w Run(tf *TaskFlow) Executor // Run start to schedule and execute taskflow }
Executor schedule and execute taskflow
func NewExecutor ¶
NewExecutor return a Executor with a specified max goroutine concurrency(recommend a value bigger than Runtime.NumCPU, **MUST** bigger than num(subflows). )
type Subflow ¶
type Subflow struct {
// contains filtered or unexported fields
}
Subflow Wrapper
func (*Subflow) NewCondition ¶ added in v0.1.2
NewCondition returns a condition task. The predict func return value determines its successor.
func (*Subflow) NewSubflow ¶ added in v0.1.2
NewSubflow returns a subflow task
type Task ¶
type Task struct {
// contains filtered or unexported fields
}
Basic component of Taskflow
func (*Task) Precede ¶
Precede: Tasks all depend on *this*. In Addition, order of tasks is correspond to predict result, ranging from 0...len(tasks)
func (*Task) Priority ¶ added in v0.0.9
func (t *Task) Priority(p TaskPriority) *Task
Priority sets task's sche priority. Noted that due to goroutine concurrent mode, it can only assure task schedule priority, rather than its execution.
type TaskFlow ¶
type TaskFlow struct {
// contains filtered or unexported fields
}
TaskFlow represents a series of tasks
func (*TaskFlow) NewCondition ¶ added in v0.1.2
NewCondition returns a attached condition task. NOTICE: The predict func return value determines its successor.
func (*TaskFlow) NewSubflow ¶ added in v0.1.2
NewSubflow returns a attached subflow task NOTICE: instantiate will be invoke only once to instantiate itself
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
examples
|
|
conditional
command
|
|
fibonacci
command
|
|
loop
command
|
|
parallel_merge_sort
command
|
|
priority
command
|
|
simple
command
|
|
word_count
command
|
|