task

package
v1.0.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

type Factory interface {
	DrySpec(s string) bool
	AddCron(id uint32, spec string) error
	UpdateCron(id uint32, spec string) error
	RemoveCron(id uint32) error
	Scheduler(id uint32, force bool) error
	CancelExec(ctx kratosx.Context, uuid string) error
}

type GetTaskGroupRequest

type GetTaskGroupRequest struct {
	Id *uint32 `json:"id"`
}

type GetTaskRequest

type GetTaskRequest struct {
	Id *uint32 `json:"id"`
}

type ListTaskGroupRequest

type ListTaskGroupRequest struct {
	Page     uint32  `json:"page"`
	PageSize uint32  `json:"pageSize"`
	Order    *string `json:"order"`
	OrderBy  *string `json:"orderBy"`
	Name     *string `json:"name"`
}

type ListTaskRequest

type ListTaskRequest struct {
	Page     uint32  `json:"page"`
	PageSize uint32  `json:"pageSize"`
	Order    *string `json:"order"`
	OrderBy  *string `json:"orderBy"`
	GroupId  *uint32 `json:"groupId"`
	Name     *string `json:"name"`
	Tag      *string `json:"tag"`
	Status   *bool   `json:"status"`
}

type Repo

type Repo interface {
	// GetTaskGroup 获取指定的任务分组
	GetTaskGroup(ctx kratosx.Context, id uint32) (*TaskGroup, error)

	// ListTaskGroup 获取任务分组列表
	ListTaskGroup(ctx kratosx.Context, req *ListTaskGroupRequest) ([]*TaskGroup, uint32, error)

	// CreateTaskGroup 创建任务分组
	CreateTaskGroup(ctx kratosx.Context, req *TaskGroup) (uint32, error)

	// UpdateTaskGroup 更新任务分组
	UpdateTaskGroup(ctx kratosx.Context, req *TaskGroup) error

	// DeleteTaskGroup 删除任务分组
	DeleteTaskGroup(ctx kratosx.Context, id uint32) error

	// GetTask 获取指定的任务信息
	GetTask(ctx kratosx.Context, id uint32) (*Task, error)

	// ListTask 获取任务信息列表
	ListTask(ctx kratosx.Context, req *ListTaskRequest) ([]*Task, uint32, error)

	// CreateTask 创建任务信息
	CreateTask(ctx kratosx.Context, req *Task) (uint32, error)

	// UpdateTask 更新任务信息
	UpdateTask(ctx kratosx.Context, req *Task) error

	// UpdateTaskStatus 更新任务信息状态
	UpdateTaskStatus(ctx kratosx.Context, id uint32, status bool) error

	// DeleteTask 删除任务信息
	DeleteTask(ctx kratosx.Context, id uint32) error

	// GetSpecs 获取所有的表达式
	GetSpecs(ctx kratosx.Context) map[uint32]string
}

type Task

type Task struct {
	Id            uint32       `json:"id"`
	GroupId       uint32       `json:"groupId"`
	Name          string       `json:"name"`
	Tag           string       `json:"tag"`
	Spec          string       `json:"spec"`
	Status        *bool        `json:"status"`
	WorkerType    string       `json:"workerType"`
	WorkerGroupId *uint32      `json:"workerGroupId"`
	WorkerId      *uint32      `json:"workerId"`
	ExecType      string       `json:"execType"`
	ExecValue     string       `json:"execValue"`
	ExpectCode    uint32       `json:"expectCode"`
	RetryCount    uint32       `json:"retryCount"`
	RetryWaitTime uint32       `json:"retryWaitTime"`
	MaxExecTime   uint32       `json:"maxExecTime"`
	Version       string       `json:"version"`
	Description   *string      `json:"description"`
	CreatedAt     int64        `json:"createdAt"`
	UpdatedAt     int64        `json:"updatedAt"`
	Group         *TaskGroup   `json:"group"`
	Worker        *Worker      `json:"worker"`
	WorkerGroup   *WorkerGroup `json:"workerGroup"`
}

type TaskGroup

type TaskGroup struct {
	Id          uint32  `json:"id"`
	Name        string  `json:"name"`
	Description *string `json:"description"`
	CreatedAt   int64   `json:"createdAt"`
	UpdatedAt   int64   `json:"updatedAt"`
}

type UseCase

type UseCase struct {
	// contains filtered or unexported fields
}

func NewUseCase

func NewUseCase(config *conf.Config, repo Repo, factory Factory) *UseCase

func (*UseCase) CancelExecTask

func (u *UseCase) CancelExecTask(ctx kratosx.Context, uuid string) error

CancelExecTask 取消执行任务

func (*UseCase) CreateTask

func (u *UseCase) CreateTask(ctx kratosx.Context, req *Task) (uint32, error)

CreateTask 创建任务信息

func (*UseCase) CreateTaskGroup

func (u *UseCase) CreateTaskGroup(ctx kratosx.Context, req *TaskGroup) (uint32, error)

CreateTaskGroup 创建任务分组

func (*UseCase) DeleteTask

func (u *UseCase) DeleteTask(ctx kratosx.Context, id uint32) error

DeleteTask 删除任务信息

func (*UseCase) DeleteTaskGroup

func (u *UseCase) DeleteTaskGroup(ctx kratosx.Context, id uint32) error

DeleteTaskGroup 删除任务分组

func (*UseCase) ExecTask

func (u *UseCase) ExecTask(ctx kratosx.Context, id uint32) error

ExecTask 执行任务

func (*UseCase) GetTask

func (u *UseCase) GetTask(ctx kratosx.Context, req *GetTaskRequest) (*Task, error)

GetTask 获取指定的任务信息

func (*UseCase) GetTaskGroup

func (u *UseCase) GetTaskGroup(ctx kratosx.Context, req *GetTaskGroupRequest) (*TaskGroup, error)

GetTaskGroup 获取指定的任务分组

func (*UseCase) ListTask

func (u *UseCase) ListTask(ctx kratosx.Context, req *ListTaskRequest) ([]*Task, uint32, error)

ListTask 获取任务信息列表

func (*UseCase) ListTaskGroup

func (u *UseCase) ListTaskGroup(ctx kratosx.Context, req *ListTaskGroupRequest) ([]*TaskGroup, uint32, error)

ListTaskGroup 获取任务分组列表

func (*UseCase) UpdateTask

func (u *UseCase) UpdateTask(ctx kratosx.Context, req *Task) error

UpdateTask 更新任务信息

func (*UseCase) UpdateTaskGroup

func (u *UseCase) UpdateTaskGroup(ctx kratosx.Context, req *TaskGroup) error

UpdateTaskGroup 更新任务分组

func (*UseCase) UpdateTaskStatus

func (u *UseCase) UpdateTaskStatus(ctx kratosx.Context, id uint32, status bool) error

UpdateTaskStatus 更新任务信息状态

type Worker

type Worker struct {
	Name string `json:"name"`
}

type WorkerGroup

type WorkerGroup struct {
	Name string `json:"name"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL