scheduler

package
v0.0.0-...-f5948c0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseEngineStatistics

type BaseEngineStatistics = WorkStatistics

BaseEngineStatistics 基本引擎统计数据

type Config

type Config[KEY comparable, T, W any] struct {
	WorkerCount uint
}

type Engine

type Engine[KEY comparable, T, W any] struct {
	BaseEngineStatistics
	// contains filtered or unexported fields
}

func NewEngine

func NewEngine[KEY comparable, T, W any](workerCount uint) *Engine[KEY, T, W]

func NewEngineWithContext

func NewEngineWithContext[KEY comparable, T, W any](workerCount uint, ctx context.Context) *Engine[KEY, T, W]

func (*Engine[KEY, T, W]) AddFixedTask

func (e *Engine[KEY, T, W]) AddFixedTask(workerId int, task *Task[KEY, T]) error

func (*Engine[KEY, T, W]) AddTask

func (e *Engine[KEY, T, W]) AddTask(task *Task[KEY, T])

func (*Engine[KEY, T, W]) AddTasks

func (e *Engine[KEY, T, W]) AddTasks(tasks ...*Task[KEY, T])

func (*Engine[KEY, T, W]) AddWorker

func (e *Engine[KEY, T, W]) AddWorker(num int)

func (*Engine[KEY, T, W]) Cancel

func (e *Engine[KEY, T, W]) Cancel()

func (*Engine[KEY, T, W]) Context

func (e *Engine[KEY, T, W]) Context() context.Context

func (*Engine[KEY, T, W]) MonitorInterval

func (e *Engine[KEY, T, W]) MonitorInterval(interval time.Duration)

func (*Engine[KEY, T, W]) NewFixedWorker

func (e *Engine[KEY, T, W]) NewFixedWorker(interval time.Duration) int

func (*Engine[KEY, T, W]) RandSpeedLimited

func (e *Engine[KEY, T, W]) RandSpeedLimited(start, stop time.Duration)

func (*Engine[KEY, T, W]) Run

func (e *Engine[KEY, T, W]) Run(tasks ...*Task[KEY, T])

func (*Engine[KEY, T, W]) RunSingleWorker

func (e *Engine[KEY, T, W]) RunSingleWorker(tasks ...*Task[KEY, T])

func (*Engine[KEY, T, W]) SpeedLimited

func (e *Engine[KEY, T, W]) SpeedLimited(interval time.Duration)

func (*Engine[KEY, T, W]) Stop

func (e *Engine[KEY, T, W]) Stop()

func (*Engine[KEY, T, W]) SyncRun

func (e *Engine[KEY, T, W]) SyncRun(tasks ...*Task[KEY, T])

type Task

type Task[KEY comparable, T any] struct {
	TaskMeta[KEY]
	TaskFunc
	Props T
}

type TaskFunc

type TaskFunc func(context.Context)

type TaskMeta

type TaskMeta[KEY comparable] struct {
	Key      KEY
	Describe string
	Priority int
	// contains filtered or unexported fields
}

func (*TaskMeta[KEY]) SetPriority

func (t *TaskMeta[KEY]) SetPriority(priority int)

type Tasks

type Tasks[KEY comparable, T any] []*Task[KEY, T]

func (Tasks[KEY, T]) Less

func (tasks Tasks[KEY, T]) Less(i, j int) bool

type WorkStatistics

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

WorkStatistics worker统计数据

type Worker

type Worker[KEY comparable, T, W any] struct {
	Id uint

	Props W
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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