Documentation
¶
Overview ¶
Package task 提供模块无关的任务注册、执行和 Cron 调度能力。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContextTaskExec ¶
type ContextTaskExec interface {
ExecContext(context.Context, map[string]string) ([]string, error)
}
ContextTaskExec 定义可以接收应用上下文的任务执行接口。
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry 保存已装配模块贡献的任务执行器。
type Result ¶
type Result struct {
// Name 是任务名称。
Name string
// StartedAt 是任务开始时间。
StartedAt time.Time
// Duration 是任务执行耗时。
Duration time.Duration
// Output 是任务输出。
Output []string
// Err 是任务执行错误。
Err error
}
Result 描述一次任务执行结果。
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler 将具备 Cron 表达式的任务接入 Kratos 服务生命周期。
func NewScheduler ¶
NewScheduler 创建任务调度服务,并在启动前注册全部静态调度项。
Click to show internal directories.
Click to hide internal directories.