Documentation ¶
Index ¶
- type CatchFn
- type Controller
- type DefaultProgressReporter
- func (inst *DefaultProgressReporter) HandleCancel(f ProgressControlHandlerFn)
- func (inst *DefaultProgressReporter) HandlePause(f ProgressControlHandlerFn)
- func (inst *DefaultProgressReporter) HandleResume(f ProgressControlHandlerFn)
- func (inst *DefaultProgressReporter) Report(p *Progress)
- func (inst *DefaultProgressReporter) Update(p *Progress)
- type DefaultProgressReporterFactory
- type Executor
- type FinallyFn
- type Progress
- type ProgressControlHandlerFn
- type ProgressReporter
- type ProgressReporterFactory
- type ProgressReporterHolder
- type Promise
- type PromiseFn
- type RejectFn
- type ResolveFn
- type Runnable
- type State
- type Status
- type ThenFn
Constants ¶
This section is empty.
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 DefaultProgressReporter ¶ added in v0.0.76
type DefaultProgressReporter struct { }
func (*DefaultProgressReporter) HandleCancel ¶ added in v0.0.76
func (inst *DefaultProgressReporter) HandleCancel(f ProgressControlHandlerFn)
func (*DefaultProgressReporter) HandlePause ¶ added in v0.0.76
func (inst *DefaultProgressReporter) HandlePause(f ProgressControlHandlerFn)
func (*DefaultProgressReporter) HandleResume ¶ added in v0.0.76
func (inst *DefaultProgressReporter) HandleResume(f ProgressControlHandlerFn)
func (*DefaultProgressReporter) Report ¶ added in v0.0.76
func (inst *DefaultProgressReporter) Report(p *Progress)
func (*DefaultProgressReporter) Update ¶ added in v0.0.76
func (inst *DefaultProgressReporter) Update(p *Progress)
type DefaultProgressReporterFactory ¶ added in v0.0.76
type DefaultProgressReporterFactory struct { }
func (*DefaultProgressReporterFactory) Create ¶ added in v0.0.76
func (inst *DefaultProgressReporterFactory) Create() ProgressReporter
type Progress ¶ added in v0.0.70
type Progress struct { TaskID string // 任务ID Name string // 项目名称(ID) Title string // 标题 Unit string // 单位 Message string // 描述当前进度的消息 Value int64 // 当前值 ValueMin int64 // 最小值 ValueMax int64 // 最大值 TimeBegin int64 // 开始时间 TimeEnd int64 // 结束时间 // Done bool // 是否已完成 (已废弃,用 State) // Cancelled bool // 是否已取消(已废弃,用 Statue) State State // 过程中的状态 Status Status // 最终状态 }
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) // Update 更新状态 state|status Update(p *Progress) HandleCancel(f ProgressControlHandlerFn) HandlePause(f ProgressControlHandlerFn) HandleResume(f ProgressControlHandlerFn) }
ProgressReporter 进度报告者(服务端接口)
func GetProgressReporter ¶ added in v0.0.76
func GetProgressReporter(ctx context.Context) (ProgressReporter, error)
GetProgressReporter 取报告者
type ProgressReporterFactory ¶ added in v0.0.76
type ProgressReporterFactory interface {
Create() ProgressReporter
}
ProgressReporterFactory 进度报告者工厂
type ProgressReporterHolder ¶ added in v0.0.76
type ProgressReporterHolder struct {
// contains filtered or unexported fields
}
ProgressReporterHolder 报告者管理器
func GetProgressReporterHolder ¶ added in v0.0.76
func GetProgressReporterHolder(ctx context.Context) (*ProgressReporterHolder, error)
GetProgressReporterHolder 取报告者管理器
func (*ProgressReporterHolder) GetFactory ¶ added in v0.0.76
func (inst *ProgressReporterHolder) GetFactory() ProgressReporterFactory
GetFactory 获取报告者工厂
func (*ProgressReporterHolder) GetReporter ¶ added in v0.0.76
func (inst *ProgressReporterHolder) GetReporter() (ProgressReporter, error)
GetReporter 获取报告者
func (*ProgressReporterHolder) SetFactory ¶ added in v0.0.76
func (inst *ProgressReporterHolder) SetFactory(f ProgressReporterFactory)
SetFactory 设置报告者工厂
func (*ProgressReporterHolder) SetReporter ¶ added in v0.0.76
func (inst *ProgressReporterHolder) SetReporter(r ProgressReporter)
SetReporter 设置报告者
type Promise ¶
type Promise interface { Then(fn ThenFn) Promise Catch(fn CatchFn) Promise Finally(fn FinallyFn) Promise }
Promise 对象用于表示一个异步操作的最终完成 (或失败)及其结果值。
func NewPromiseWithExecutor ¶
NewPromiseWithExecutor 新建一个 Promise 对象的实例, 并使用指定的 Executor 执行
Click to show internal directories.
Click to hide internal directories.