Documentation ¶
Index ¶
Constants ¶
View Source
const ( StateStarting = 1 StateStarted = 2 StateRunning = 3 StatePaused = 4 StateCancelling = 5 StateStopping = 6 StateStopped = 7 )
定义任务过程中的状态
View Source
const ( StatusOK = 200 StatusCancelled = 300 StatusFail = 500 )
定义任务的最终状态
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶ added in v0.0.70
type Controller interface { Pause() error Resume() error Cancel() error GetState() State GetStatus() Status GetError() error GetProgress() map[string]*Progress }
Controller 任务控制器(用户端接口)
type Progress ¶ added in v0.0.70
type Progress struct { TaskID string // 任务ID Name string // 项目名称(ID) Title string // 标题 Unit string // 单位 Value int64 // 当前值 ValueMin int64 // 最小值 ValueMax int64 // 最大值 TimeBegin int64 // 开始时间 TimeEnd int64 // 结束时间 Done bool // 是否已完成 Cancelled bool // 是否已取消 }
Progress 进度对象
type ProgressControlHandlerFn ¶ added in v0.0.70
type ProgressControlHandlerFn func(reporter ProgressReporter) error
ProgressControlHandlerFn 进度控制处理函数
type ProgressReporter ¶ added in v0.0.70
type ProgressReporter interface { Report(p *Progress) UpdateStatus(s Status) UpdateState(s State) HandleCancel(f ProgressControlHandlerFn) HandlePause(f ProgressControlHandlerFn) HandleResume(f ProgressControlHandlerFn) }
ProgressReporter 进度报告者(服务端接口)
Click to show internal directories.
Click to hide internal directories.