Documentation ¶
Index ¶
- Constants
- func CreateSubtask(taskId taskmodel.TaskIdType, taskType uint32, impl taskmodel.ITaskGenerator, ...) error
- func GetTaskGenerator(taskType uint32, generator *taskmodel.ITaskGenerator) error
- func GetTaskStatusKey(taskId taskmodel.TaskIdType) string
- func LoadStatus(taskId taskmodel.TaskIdType, retTaskStatus *string) error
- func SaveStatus(taskId taskmodel.TaskIdType, taskStatus string) error
- type FlowHelper
- type GenerationFlow
- type TaskGenerationImpl
Constants ¶
View Source
const ( SubtaskGenerationInterval = 10 SubtaskGenerationMaxTime = 3600 )
View Source
const ( SubtaskDefaultTimeout = 300 SubtaskMaxTimeout = 1800 )
View Source
const TaskStatusKeyPrefix = "task.status."
保存任务创建
Variables ¶
This section is empty.
Functions ¶
func CreateSubtask ¶
func CreateSubtask( taskId taskmodel.TaskIdType, taskType uint32, impl taskmodel.ITaskGenerator, subtaskData *taskmodel.SubtaskBody, finished *bool, ) error
创建一个子任务
func GetTaskGenerator ¶
func GetTaskGenerator(taskType uint32, generator *taskmodel.ITaskGenerator) error
get the generator object of the specified task type
func LoadStatus ¶
func LoadStatus( taskId taskmodel.TaskIdType, retTaskStatus *string, ) error
根据任务ID从Redis中加载任务的生成状态
func SaveStatus ¶
func SaveStatus( taskId taskmodel.TaskIdType, taskStatus string, ) error
保存任务的运行状态数据
Types ¶
type FlowHelper ¶
type FlowHelper struct { GenerationQueues generationqueue.GenerationiQueueMgr // subtask queue manager GeneratorMap map[taskmodel.TaskIdType]TaskGenerationImpl // task generator object map Mutex sync.Mutex // lock }
generation flow helpr
func GetFlowHelper ¶
func GetFlowHelper() *FlowHelper
func NewFlowHelper ¶
func NewFlowHelper() *FlowHelper
func (*FlowHelper) Begin ¶
func (generator *FlowHelper) Begin( taskId taskmodel.TaskIdType, taskType uint32, taskParam *taskmodel.TaskParam, taskGenerator taskmodel.ITaskGenerator, ) error
func (*FlowHelper) End ¶
func (generator *FlowHelper) End( taskId taskmodel.TaskIdType, ) error
func (*FlowHelper) GenerationLoop ¶
func (generator *FlowHelper) GenerationLoop( taskId taskmodel.TaskIdType, ) error
type GenerationFlow ¶
type GenerationFlow struct { TaskId taskmodel.TaskIdType TaskType uint32 Generator taskmodel.ITaskGenerator TaskParam *taskmodel.TaskParam }
generation flow
func NewGenerationFlow ¶
func NewGenerationFlow() *GenerationFlow
create a generation flow object every task has their own generation flow object
func (*GenerationFlow) FinishGeneration ¶
func (flow *GenerationFlow) FinishGeneration() error
finish the generation process
func (*GenerationFlow) GenerationLoop ¶
func (flow *GenerationFlow) GenerationLoop() error
generation loop
func (*GenerationFlow) InitGeneration ¶
func (flow *GenerationFlow) InitGeneration( taskId taskmodel.TaskIdType, taskType uint32, taskParam *taskmodel.TaskParam, ) error
init the generation
type TaskGenerationImpl ¶
type TaskGenerationImpl struct { Impl taskmodel.ITaskGenerator TaskType uint32 }
Click to show internal directories.
Click to hide internal directories.