Documentation ¶
Index ¶
- Constants
- Variables
- type Log
- type LogRepo
- type LogUseCase
- type PageLogRequest
- type PageTaskRequest
- type PageWorkerGroupRequest
- type PageWorkerRequest
- type Task
- type TaskFactory
- type TaskGroup
- type TaskRepo
- type TaskUseCase
- func (u *TaskUseCase) AddTask(ctx kratosx.Context, task *Task) (uint32, error)
- func (u *TaskUseCase) AddTaskGroup(ctx kratosx.Context, tg *TaskGroup) (uint32, error)
- func (u *TaskUseCase) AllTaskGroup(ctx kratosx.Context) ([]*TaskGroup, error)
- func (u *TaskUseCase) CancelTask(ctx kratosx.Context, uuid string) error
- func (u *TaskUseCase) DeleteTask(ctx kratosx.Context, id uint32) error
- func (u *TaskUseCase) DeleteTaskGroup(ctx kratosx.Context, id uint32) error
- func (u *TaskUseCase) DisableTask(ctx kratosx.Context, id uint32) error
- func (u *TaskUseCase) EnableTask(ctx kratosx.Context, id uint32) error
- func (u *TaskUseCase) ExecTask(ctx kratosx.Context, id uint32) error
- func (u *TaskUseCase) PageTask(ctx kratosx.Context, req *PageTaskRequest) ([]*Task, uint32, error)
- func (u *TaskUseCase) UpdateTask(ctx kratosx.Context, task *Task) error
- func (u *TaskUseCase) UpdateTaskGroup(ctx kratosx.Context, tg *TaskGroup) error
- type Worker
- type WorkerFactory
- type WorkerGroup
- type WorkerRepo
- type WorkerUseCase
- func (u *WorkerUseCase) AddWorker(ctx kratosx.Context, worker *Worker) (uint32, error)
- func (u *WorkerUseCase) AddWorkerGroup(ctx kratosx.Context, tg *WorkerGroup) (uint32, error)
- func (u *WorkerUseCase) AllWorkerGroup(ctx kratosx.Context) ([]*WorkerGroup, error)
- func (u *WorkerUseCase) DeleteWorker(ctx kratosx.Context, id uint32) error
- func (u *WorkerUseCase) DeleteWorkerGroup(ctx kratosx.Context, id uint32) error
- func (u *WorkerUseCase) DisableWorker(ctx kratosx.Context, id uint32) error
- func (u *WorkerUseCase) EnableWorker(ctx kratosx.Context, id uint32) error
- func (u *WorkerUseCase) PageWorker(ctx kratosx.Context, req *PageWorkerRequest) ([]*Worker, uint32, error)
- func (u *WorkerUseCase) UpdateWorker(ctx kratosx.Context, worker *Worker) error
- func (u *WorkerUseCase) UpdateWorkerGroup(ctx kratosx.Context, tg *WorkerGroup) error
Constants ¶
View Source
const ( ExecRunning = "running" ExecFail = "fail" ExecCancel = "cancel" ExecSuccess = "success" )
View Source
const ( WorkerRunning = "running" WorkerEnabled = true WorkerDisabled = false )
View Source
const (
ExecTypeGroup = "group"
)
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Log ¶
type Log struct { ID uint32 `json:"id"` Uuid string `json:"uuid"` WorkerId uint32 `json:"worker_id"` WorkerSnapshot string `json:"worker_snapshot"` TaskId uint32 `json:"task_id"` TaskSnapshot string `json:"task_snapshot"` Start int64 `json:"start"` End int64 `json:"end"` Content string `json:"content"` Status string `json:"status"` }
type LogRepo ¶
type LogRepo interface { AddLog(ctx kratosx.Context, in *Log) (uint32, error) GetLog(ctx kratosx.Context, id uint32) (*Log, error) PageLog(ctx kratosx.Context, req *PageLogRequest) ([]*Log, uint32, error) AppendLogContent(ctx kratosx.Context, uuid string, c string) error UpdateLogStatus(ctx kratosx.Context, uuid string, err error) error TaskIsRunning(ctx kratosx.Context, uuid string) bool }
type LogUseCase ¶
type LogUseCase struct {
// contains filtered or unexported fields
}
func NewLogUseCase ¶
func NewLogUseCase(config *conf.Config, repo LogRepo) *LogUseCase
NewLogUseCase 创建UseCase实体
func (*LogUseCase) PageLog ¶
func (u *LogUseCase) PageLog(ctx kratosx.Context, req *PageLogRequest) ([]*Log, uint32, error)
PageLog 获取分页工作节点
type PageLogRequest ¶
type PageTaskRequest ¶
type PageWorkerGroupRequest ¶
type PageWorkerRequest ¶
type Task ¶
type Task struct { ktypes.BaseModel GroupId uint32 `json:"group_id"` Name string `json:"name"` Tag string `json:"tag"` Spec string `json:"spec"` SelectType string `json:"select_type"` WorkerGroupId *uint32 `json:"worker_group_id"` WorkerId *uint32 `json:"worker_id"` ExecType string `json:"exec_type"` ExecValue string `json:"exec_value"` ExpectCode *uint32 `json:"expect_code"` RetryCount *uint32 `json:"retry_count"` RetryWaitTime *uint32 `json:"retry_wait_time"` MaxExecTime *uint32 `json:"max_exec_time"` Status *bool `json:"status"` Version string `json:"version"` Description string `json:"description"` Group *TaskGroup `json:"group"` }
type TaskFactory ¶
type TaskRepo ¶
type TaskRepo interface { AddTaskGroup(ctx kratosx.Context, in *TaskGroup) (uint32, error) AllTaskGroup(ctx kratosx.Context) ([]*TaskGroup, error) UpdateTaskGroup(ctx kratosx.Context, c *TaskGroup) error DeleteTaskGroup(ctx kratosx.Context, id uint32) error GetSpecs(ctx kratosx.Context) map[uint32]string AddTask(ctx kratosx.Context, in *Task) (uint32, error) GetTask(ctx kratosx.Context, id uint32) (*Task, error) GetWorkerByUuid(ctx kratosx.Context, uuid string) (*Worker, error) PageTask(ctx kratosx.Context, req *PageTaskRequest) ([]*Task, uint32, error) UpdateTask(ctx kratosx.Context, c *Task) error DeleteTask(ctx kratosx.Context, id uint32) error CancelTask(ctx kratosx.Context, uuid string) error UpdateTaskStatus(ctx kratosx.Context, id uint32, status *bool) error }
type TaskUseCase ¶
type TaskUseCase struct {
// contains filtered or unexported fields
}
func NewTaskUseCase ¶
func NewTaskUseCase(config *conf.Config, repo TaskRepo, factory TaskFactory) *TaskUseCase
NewTaskUseCase 创建UseCase实体
func (*TaskUseCase) AddTaskGroup ¶
AddTaskGroup 添加任务分组
func (*TaskUseCase) AllTaskGroup ¶
func (u *TaskUseCase) AllTaskGroup(ctx kratosx.Context) ([]*TaskGroup, error)
AllTaskGroup 获取全部任务分组
func (*TaskUseCase) CancelTask ¶
func (u *TaskUseCase) CancelTask(ctx kratosx.Context, uuid string) error
CancelTask 取消执行任务
func (*TaskUseCase) DeleteTask ¶
func (u *TaskUseCase) DeleteTask(ctx kratosx.Context, id uint32) error
DeleteTask 删除指定任务
func (*TaskUseCase) DeleteTaskGroup ¶
func (u *TaskUseCase) DeleteTaskGroup(ctx kratosx.Context, id uint32) error
DeleteTaskGroup 删除指定任务分组
func (*TaskUseCase) DisableTask ¶
func (u *TaskUseCase) DisableTask(ctx kratosx.Context, id uint32) error
DisableTask 禁用指定任务
func (*TaskUseCase) EnableTask ¶
func (u *TaskUseCase) EnableTask(ctx kratosx.Context, id uint32) error
EnableTask 启动指定任务
func (*TaskUseCase) ExecTask ¶
func (u *TaskUseCase) ExecTask(ctx kratosx.Context, id uint32) error
ExecTask 执行任务
func (*TaskUseCase) PageTask ¶
func (u *TaskUseCase) PageTask(ctx kratosx.Context, req *PageTaskRequest) ([]*Task, uint32, error)
PageTask 获取分页任务
func (*TaskUseCase) UpdateTask ¶
func (u *TaskUseCase) UpdateTask(ctx kratosx.Context, task *Task) error
UpdateTask 修改指定任务
func (*TaskUseCase) UpdateTaskGroup ¶
func (u *TaskUseCase) UpdateTaskGroup(ctx kratosx.Context, tg *TaskGroup) error
UpdateTaskGroup 删除指定任务分组
type WorkerGroup ¶
type WorkerRepo ¶
type WorkerRepo interface { AddWorkerGroup(ctx kratosx.Context, in *WorkerGroup) (uint32, error) AllWorkerGroup(ctx kratosx.Context) ([]*WorkerGroup, error) UpdateWorkerGroup(ctx kratosx.Context, c *WorkerGroup) error DeleteWorkerGroup(ctx kratosx.Context, id uint32) error GetWorkerByGroupId(ctx kratosx.Context, id uint32) (*Worker, error) AddWorker(ctx kratosx.Context, in *Worker) (uint32, error) GetWorker(ctx kratosx.Context, id uint32) (*Worker, error) PageWorker(ctx kratosx.Context, req *PageWorkerRequest) ([]*Worker, uint32, error) UpdateWorker(ctx kratosx.Context, c *Worker) error DeleteWorker(ctx kratosx.Context, id uint32) error EnableWorker(ctx kratosx.Context, id uint32) error DisableWorker(ctx kratosx.Context, id uint32) error }
type WorkerUseCase ¶
type WorkerUseCase struct {
// contains filtered or unexported fields
}
func NewWorkerUseCase ¶
func NewWorkerUseCase(config *conf.Config, repo WorkerRepo, factory WorkerFactory) *WorkerUseCase
NewWorkerUseCase 创建UseCase实体
func (*WorkerUseCase) AddWorkerGroup ¶
func (u *WorkerUseCase) AddWorkerGroup(ctx kratosx.Context, tg *WorkerGroup) (uint32, error)
AddWorkerGroup 添加节点分组
func (*WorkerUseCase) AllWorkerGroup ¶
func (u *WorkerUseCase) AllWorkerGroup(ctx kratosx.Context) ([]*WorkerGroup, error)
AllWorkerGroup 获取全部节点分组
func (*WorkerUseCase) DeleteWorker ¶
func (u *WorkerUseCase) DeleteWorker(ctx kratosx.Context, id uint32) error
DeleteWorker 删除指定工作节点
func (*WorkerUseCase) DeleteWorkerGroup ¶
func (u *WorkerUseCase) DeleteWorkerGroup(ctx kratosx.Context, id uint32) error
DeleteWorkerGroup 删除指定节点分组
func (*WorkerUseCase) DisableWorker ¶
func (u *WorkerUseCase) DisableWorker(ctx kratosx.Context, id uint32) error
DisableWorker 禁用指定工作节点
func (*WorkerUseCase) EnableWorker ¶
func (u *WorkerUseCase) EnableWorker(ctx kratosx.Context, id uint32) error
EnableWorker 启动指定工作节点
func (*WorkerUseCase) PageWorker ¶
func (u *WorkerUseCase) PageWorker(ctx kratosx.Context, req *PageWorkerRequest) ([]*Worker, uint32, error)
PageWorker 获取分页工作节点
func (*WorkerUseCase) UpdateWorker ¶
func (u *WorkerUseCase) UpdateWorker(ctx kratosx.Context, worker *Worker) error
UpdateWorker 更新指定工作节点
func (*WorkerUseCase) UpdateWorkerGroup ¶
func (u *WorkerUseCase) UpdateWorkerGroup(ctx kratosx.Context, tg *WorkerGroup) error
UpdateWorkerGroup 删除指定节点分组
Click to show internal directories.
Click to hide internal directories.