executor

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewExecutor

func NewExecutor(ctx context.Context, options ...Option) (err error)

NewExecutor 创建执行器

Types

type Executor

type Executor interface {
	Run() (err error)
	// AddRegTask 本地注册
	AddRegTask(handler string, task FuncTask)
	// RegTask 服务器注册
	RegTask() (err error)
	// GetTaskInstance 获取调度任务实例
	GetTaskInstance() common2.RunReq
	// RunTask 运行任务
	RunTask(req common2.RunReq) common2.CallElement
}

Executor 执行器

func GetExecutor

func GetExecutor() Executor

type FuncTask

type FuncTask func(param common2.RunReq) (code int, msg string)

FuncTask 任务执行函数

type ListTask

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

ListTask 任务列表 [JobID]执行函数,并行执行时[+LogID]

func (*ListTask) Del

func (t *ListTask) Del(key string)

Del 设置数据

func (*ListTask) Exists

func (t *ListTask) Exists(key string) bool

Exists Key是否存在

func (*ListTask) Get

func (t *ListTask) Get(key string) *Task

Get 获取数据

func (*ListTask) GetAll

func (t *ListTask) GetAll() map[string]*Task

GetAll 获取所有数据

func (*ListTask) GetKeys

func (t *ListTask) GetKeys() []string

GetKeys 获取keys

func (*ListTask) Len

func (t *ListTask) Len() int

Len 长度

func (*ListTask) Set

func (t *ListTask) Set(key string, val *Task)

Set 设置数据

type Option

type Option func(e *executor)

func WithCancelReg

func WithCancelReg(cancel bool) Option

func WithClientId

func WithClientId(clientId string) Option

func WithDelay

func WithDelay(delay int) Option

func WithHost

func WithHost(host string) Option

func WithTask

func WithTask(handler string, task FuncTask) Option

WithTask 本地注册任务

type Task

type Task struct {
	Id    string
	Name  string
	Param common2.RunReq

	StartTime int64
	EndTime   int64
	// contains filtered or unexported fields
}

Task 任务

func (*Task) Info

func (t *Task) Info() string

Info 任务信息

func (*Task) Run

func (t *Task) Run() common2.CallElement

Run 运行任务

Jump to

Keyboard shortcuts

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