Documentation ¶
Index ¶
- type Monitor
- func (tm *Monitor) Fail(name, err string)
- func (tm *Monitor) Finish(name string)
- func (tm *Monitor) Get(name string) int
- func (tm *Monitor) List(workers ...string) []Task
- func (tm *Monitor) NewTaskTracker(name string) *Tracker
- func (tm *Monitor) Pending(name string)
- func (tm *Monitor) Start(name string, total int)
- func (tm *Monitor) Suspend(name string, flag bool)
- func (tm *Monitor) Update(name string, done int)
- type Runner
- type Scheduler
- type Status
- type SubTaskTracker
- type Task
- type Tasks
- type Tracker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Monitor ¶
Monitor monitors the progress of all tasks.
func NewTaskMonitor ¶
func NewTaskMonitor() *Monitor
NewTaskMonitor creates a Monitor and add pending tasks.
func (*Monitor) List ¶
List all tasks and remove tasks from disconnected workers.
func (*Monitor) NewTaskTracker ¶
NewTaskTracker creates a Tracker from Monitor.
type Runner ¶
Runner is a Scheduler bounded with a task.
type Scheduler ¶
Scheduler schedules that pre-locked tasks are executed first.
func (*Scheduler) Lock ¶
Lock gets the permission to run task.
func (*Scheduler) PreLock ¶
PreLock a task, the task has the privilege to run first than un-pre-clocked tasks.
type SubTaskTracker ¶
SubTaskTracker tracks part of progress of a task.
func (*SubTaskTracker) Fail ¶
func (tt *SubTaskTracker) Fail(err string)
Fail reports the error message.
func (*SubTaskTracker) SubTracker ¶
func (tt *SubTaskTracker) SubTracker() model.Tracker
SubTracker creates a sub tracker of a sub tracker.
func (*SubTaskTracker) Suspend ¶
func (tt *SubTaskTracker) Suspend(flag bool)
func (*SubTaskTracker) Update ¶
func (tt *SubTaskTracker) Update(done int)
Update the progress of current task.
type Task ¶
type Task struct { Name string Status Status Done int Total int StartTime time.Time FinishTime time.Time Error string }
Task progress information.
func NewTaskFromPB ¶
func NewTaskFromPB(in *protocol.PushTaskInfoRequest) *Task
func (*Task) ToPB ¶
func (t *Task) ToPB() *protocol.PushTaskInfoRequest