scheduler

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseTask

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

func (*BaseTask) BeforeExecute

func (t *BaseTask) BeforeExecute() bool

func (*BaseTask) Finish

func (t *BaseTask) Finish()

func (*BaseTask) Init

func (t *BaseTask) Init(key string)

func (*BaseTask) Key

func (t *BaseTask) Key() string

func (*BaseTask) OnFinish

func (t *BaseTask) OnFinish(event Event)

func (*BaseTask) Stop

func (t *BaseTask) Stop()

func (*BaseTask) UUID

func (t *BaseTask) UUID() uint64

type Event

type Event func()

type EventManager

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

func (*EventManager) Dispatch

func (em *EventManager) Dispatch()

func (*EventManager) Register

func (em *EventManager) Register(event func())

type ListenHook

type ListenHook func(signal chan struct{}, onClose func())

type Task

type Task interface {
	Key() string
	UUID() uint64
	BeforeExecute() bool
	Execute()
	Stop()
	Finish()
	OnFinish(event Event)
}

type TaskGroup

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

func NewTaskGroup

func NewTaskGroup(key string) *TaskGroup

func (*TaskGroup) Add

func (tg *TaskGroup) Add(task Task)

func (*TaskGroup) Finish

func (tg *TaskGroup) Finish()

func (*TaskGroup) Key

func (tg *TaskGroup) Key() string

func (*TaskGroup) Len

func (tg *TaskGroup) Len() int

func (*TaskGroup) OnFinish

func (tg *TaskGroup) OnFinish(event Event)

type TaskScheduler

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

func NewTaskScheduler

func NewTaskScheduler(listen ListenHook, limiter limiter.Fixed) *TaskScheduler

func (*TaskScheduler) CloseAll

func (ts *TaskScheduler) CloseAll()

func (*TaskScheduler) Execute added in v1.4.0

func (ts *TaskScheduler) Execute(task Task, signal chan struct{}, async bool)

func (*TaskScheduler) ExecuteBatch

func (ts *TaskScheduler) ExecuteBatch(tasks []Task, signal chan struct{})

func (*TaskScheduler) ExecuteTaskGroup

func (ts *TaskScheduler) ExecuteTaskGroup(tg *TaskGroup, signal chan struct{})

func (*TaskScheduler) IsRunning

func (ts *TaskScheduler) IsRunning(key string) bool

func (*TaskScheduler) Wait

func (ts *TaskScheduler) Wait()

Jump to

Keyboard shortcuts

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