Documentation
¶
Index ¶
- func ContextWithTask(ctx context.Context, task *Task) context.Context
- type Task
- func (t *Task) CreateChild(name string) *Task
- func (t *Task) Fail(err error)
- func (t *Task) Finish() error
- func (t *Task) Go(name string, f func(task *Task) error)
- func (t *Task) ID() string
- func (t *Task) JobID() string
- func (t *Task) ReportMessage(message string)
- func (t *Task) ReportProgress(current, total int)
- func (t *Task) RunChild(name string, f func(task *Task) error) error
- func (t *Task) Start()
- func (t *Task) StartChild(name string) *Task
- func (t *Task) Wait() error
- type TaskTracker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Task ¶
func CurrentTask ¶
func (*Task) CreateChild ¶
func (*Task) Finish ¶
Waits for any subtasks to complete, then reports this task as complete. Status will be failed if any subtask fails, or if Fail() is called. It is safe to call Finish() multiple times.
func (*Task) JobID ¶
Job ID associated with this task. Might be empty string if task tracking failed.
func (*Task) ReportMessage ¶
func (*Task) ReportProgress ¶
func (*Task) Start ¶
func (t *Task) Start()
Marks a task as started. The caller is responsible for also calling .Finish().
func (*Task) StartChild ¶
type TaskTracker ¶
func (*TaskTracker) CreateTask ¶
func (tt *TaskTracker) CreateTask(ctx context.Context, name string) *Task
Creates a task in the Pending state. Call task.Start() on it, or use StartTask method for convenience.
Click to show internal directories.
Click to hide internal directories.