work

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WorkStatusType

type WorkStatusType int
const (
	Created  WorkStatusType = iota // 已创建
	Prepared                       // 已就绪
	Running                        // 运行中
	Idle                           // 空闲中
	Fault                          // 故障中
)

type Worker

type Worker struct {
	Id       string               // 唯一标识
	Context  context.Context      // worker的上下文
	JobCtx   context.Context      // 当前工作的上下文
	Status   WorkStatusType       // 当前状态
	Desc     string               // 描述
	JobCh    chan context.Context // 工作队列(输入)
	OutCh    chan string          // 运行情况(日志)队列 (输出)
	ResultCh chan model.RespModel // 运行结果(输出)
}

func NewWorker

func NewWorker(ctx context.Context, id string) *Worker

func (*Worker) CancelWork

func (w *Worker) CancelWork()

func (*Worker) GetStatus

func (w *Worker) GetStatus() WorkStatusType

Jump to

Keyboard shortcuts

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