Documentation ¶
Index ¶
- Constants
- Variables
- func GetStatusText(extraMapping map[int]string, status int) string
- func RunTask(wrap Wrap) error
- type BaseTask
- func (t *BaseTask) AbortError(err error) error
- func (t *BaseTask) Done()
- func (t *BaseTask) Error() error
- func (t *BaseTask) GetCreated() time.Time
- func (t *BaseTask) GetEndTime() time.Time
- func (t *BaseTask) GetId() string
- func (t *BaseTask) GetParentTaskId() string
- func (t *BaseTask) GetStartTime() time.Time
- func (t *BaseTask) GetStatus() string
- func (t *BaseTask) GetType() string
- func (t *BaseTask) SetEnd()
- func (t *BaseTask) SetStart()
- func (t *BaseTask) SubTask() []Task
- type Signal
- type Task
- type TaskModule
- type TaskPool
- type Template
- type Wrap
Constants ¶
View Source
const ( StatusRunning = iota + 10000 StatusDone StatusError )
Variables ¶
View Source
var (
SignalDone = Signal("init")
)
View Source
var StatusNameMapping map[int]string = map[int]string{ StatusRunning: "Running", StatusDone: "Done", StatusError: "Error", }
Functions ¶
Types ¶
type BaseTask ¶
type BaseTask struct { Id string Type string Status string Owner string Err error OnDone chan Signal Created time.Time SubTaskList []Task StartTime time.Time EndTime time.Time ParentTaskId string }
func NewSubTask ¶
func (*BaseTask) AbortError ¶
func (*BaseTask) GetCreated ¶
func (*BaseTask) GetEndTime ¶
func (*BaseTask) GetParentTaskId ¶
func (*BaseTask) GetStartTime ¶
type TaskModule ¶
type TaskModule struct { Pool *TaskPool Converter []interface{} ListHandler haruka.RequestHandler GetTaskByIdHandler haruka.RequestHandler ErrorHandler func(context *haruka.Context, err error) }
func NewTaskModule ¶
func NewTaskModule() *TaskModule
func (*TaskModule) AddConverter ¶
func (t *TaskModule) AddConverter(converters ...interface{})
func (*TaskModule) SerializerTemplate ¶
func (t *TaskModule) SerializerTemplate(data Task) (interface{}, error)
func (*TaskModule) SerializerTemplateList ¶
func (t *TaskModule) SerializerTemplateList() (interface{}, error)
func (*TaskModule) SerializerTemplateOutput ¶
func (t *TaskModule) SerializerTemplateOutput(data interface{}) (interface{}, error)
type TaskPool ¶
func NewTaskPool ¶
func NewTaskPool() *TaskPool
func (*TaskPool) GetTaskById ¶
func (*TaskPool) GetTaskWithStatus ¶
func (*TaskPool) RemoveTaskById ¶
type Template ¶
type Template struct { Id string `json:"id"` Type string `json:"type"` Status string `json:"status"` Created string `json:"created"` Err string `json:"err,omitempty"` Output interface{} `json:"output,omitempty"` SubTask []*Template `json:"subTask,omitempty"` StartTime string `json:"startTime,omitempty"` EndTime string `json:"endTime,omitempty"` Duration uint `json:"duration,omitempty"` ParentTaskId string `json:"parentTaskId,omitempty"` }
Click to show internal directories.
Click to hide internal directories.