JCC-CSScheduler/advisor/internal/task/task.go

29 lines
659 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package task
import (
"gitlink.org.cn/cloudream/common/pkgs/task"
reporter "gitlink.org.cn/cloudream/scheduler/advisor/internal/reporter"
)
type TaskContext struct {
reporter *reporter.Reporter
}
// 需要在Task结束后主动调用completing函数将在Manager加锁期间被调用
// 因此适合进行执行结果的设置
type CompleteFn = task.CompleteFn
type Manager = task.Manager[TaskContext]
type TaskBody = task.TaskBody[TaskContext]
type Task = task.Task[TaskContext]
type CompleteOption = task.CompleteOption
func NewManager(reporter *reporter.Reporter) Manager {
return task.NewManager(TaskContext{
reporter: reporter,
})
}