Documentation ¶
Index ¶
- type Runner_I
- type RunningTask
- type TASK_IMPLEMENTATION
- type Task
- func (t *Task) Finalize() error
- func (t *Task) Finish()
- func (t *Task) Flush()
- func (t *Task) GetDuration() time.Duration
- func (t *Task) GetID() int64
- func (t *Task) GetResponseChan() chan *TaskResponse
- func (t *Task) IsFinished() bool
- func (t *Task) IsRunning() bool
- func (t *Task) Run(args []interface{}) error
- type TaskManager_I
- type TaskResponse
- type Task_I
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Runner_I ¶
type RunningTask ¶
type TASK_IMPLEMENTATION ¶
type TASK_IMPLEMENTATION func(chan struct{}, TaskManager_I, []interface{}) ([]interface{}, error)
Task implementation type. The first parameter is a chan to catch the END signal. When this channel closes, the implementation task must to finish The second parameters is a slice of input parameters for the task implementation function
type Task ¶
type Task struct { Id int64 Duration time.Duration Implementation TASK_IMPLEMENTATION Eot chan struct{} Response *TaskResponse ResponseChan chan *TaskResponse // contains filtered or unexported fields }
func (*Task) GetDuration ¶
func (*Task) GetResponseChan ¶
func (t *Task) GetResponseChan() chan *TaskResponse
func (*Task) IsFinished ¶
type TaskResponse ¶
type TaskResponse struct { Result interface{} Err error }
type Task_I ¶
type Task_I interface { GetID() int64 GetDuration() time.Duration GetResponseChan() chan *TaskResponse Run(args []interface{}) error IsRunning() bool IsFinished() bool Finalize() error Flush() }
Task
func GetTask ¶
taking a Task to be waked up by a runner instance Parameters:
id: Task's identification. It must be unique per task duration: Maximum duration of the task. The task's implementation function is responsible for catching the closing of the EOT channel and process these event as a finalization request. See the test cases for more details about it. **special case**: 0 duration stands for infinite task implementation: Implementation function of the task. It my be complaint with the TASK_IMPLEMENTATION type
Click to show internal directories.
Click to hide internal directories.