task

package
v0.0.0-...-a32abf6 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: Unlicense Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxPageSize  = 1000
	MaxQueueSize = 10
	OnceFormat   = "04 15 02 01"
)
View Source
const (
	EffectType taskType = iota

	ExpiryType
)

Variables

This section is empty.

Functions

func InitTask

func InitTask()

Types

type EffectJob

type EffectJob struct {
	Id       int64
	ExecTime int64
}

func (*EffectJob) Run

func (t *EffectJob) Run()

type ExpiryJob

type ExpiryJob struct {
	Id       int64
	ExecTime int64
}

func (*ExpiryJob) Run

func (t *ExpiryJob) Run()

type RunJob

type RunJob struct {
	Id     int64
	HostId int64
	Name   string
	Cmd    string
	JobId  cron.EntryID
}

func (*RunJob) Run

func (t *RunJob) Run()

type Task

type Task struct {
	Cron *cron.Cron

	EntryIDs []cron.EntryID // 存放事务的id列表
	// contains filtered or unexported fields
}
var (
	T *Task
)

func (*Task) Add

func (t *Task) Add(db *gorm.DB, p model.Task) (err error)

func (*Task) AddJob

func (t *Task) AddJob(spec string, cmd cron.Job) (jobId cron.EntryID, err error)

func (*Task) Begin

func (t *Task) Begin()

func (*Task) Commit

func (t *Task) Commit()

func (*Task) Initialize

func (t *Task) Initialize() (err error)

Initialize 初始化任务, 从数据库取出所有任务, 添加到定时任务并运行

func (*Task) RollBack

func (t *Task) RollBack()

func (*Task) Run

func (t *Task) Run(p model.Task) (err error)

func (*Task) Stop

func (t *Task) Stop(id int64, tType taskType) (err error)

func (*Task) StopAll

func (t *Task) StopAll(id int64)

func (*Task) StopEffect

func (t *Task) StopEffect(id int64)

func (*Task) StopExpire

func (t *Task) StopExpire(id int64)

func (*Task) StopRun

func (t *Task) StopRun(id int64)

Jump to

Keyboard shortcuts

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