scheduler

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PUT  = 1 // 新增或更新事件
	DEL  = 2 // 删除事件
	KILL = 3 // 强行终止进程事件
)

Variables

This section is empty.

Functions

func New added in v0.4.0

func New()

New 创建调度器

Types

type Contract added in v0.4.0

type Contract interface {
	Run(ctx context.Context)    // 运行调度器
	DispatchEvent(event *Event) // 分发事件

	ResultHandler(result *models.Result) // 调度结果处理
	// contains filtered or unexported methods
}

type Event added in v0.4.0

type Event struct {
	Type     int              // 事件类型
	Pipeline *models.Pipeline // 流水线
}

type Scheduler

type Scheduler struct {
	EventsChan chan *Event                 // 事件通道
	ResultChan chan *models.Result         // 执行结果通道
	Plan       map[string]*models.Pipeline // 调度计划
	Running    map[string]*models.Pipeline // 正在运行的流水线
}
var Instance *Scheduler

func (*Scheduler) DispatchEvent added in v0.4.0

func (scheduler *Scheduler) DispatchEvent(event *Event)

DispatchEvent 加入队列

func (*Scheduler) Run added in v0.4.0

func (scheduler *Scheduler) Run(ctx context.Context)

Run 运行调度器

func (*Scheduler) TryExecute added in v0.4.0

func (scheduler *Scheduler) TryExecute(ctx context.Context) (after time.Duration)

TryExecute 尝试执行Pipeline

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳