cronman

package
v0.0.0-...-2b29b9b Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2024 License: Apache-2.0 Imports: 16 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultAdminSessionGenerator = auth.AdminCredential
	ErrCronJobNameConflict       = errors.Error("Cron job Name Conflict")
)

Functions

This section is empty.

Types

type CronJobTimerHeap

type CronJobTimerHeap []*SCronJob

func (CronJobTimerHeap) Len

func (cjth CronJobTimerHeap) Len() int

func (CronJobTimerHeap) Less

func (cjth CronJobTimerHeap) Less(i, j int) bool

func (*CronJobTimerHeap) Pop

func (cjth *CronJobTimerHeap) Pop() interface{}

func (*CronJobTimerHeap) Push

func (cjth *CronJobTimerHeap) Push(x interface{})

func (CronJobTimerHeap) String

func (c CronJobTimerHeap) String() string

func (CronJobTimerHeap) Swap

func (cjth CronJobTimerHeap) Swap(i, j int)

type ICronTimer

type ICronTimer interface {
	Next(time.Time) time.Time
}

type SCronJob

type SCronJob struct {
	Name string

	Timer    ICronTimer
	Next     time.Time
	StartRun bool
	// contains filtered or unexported fields
}

func (*SCronJob) Dump

func (job *SCronJob) Dump() string

func (*SCronJob) Run

func (job *SCronJob) Run()

type SCronJobManager

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

func GetCronJobManager

func GetCronJobManager() *SCronJobManager

func InitCronJobManager

func InitCronJobManager(isDbWorker bool, workerCount int) *SCronJobManager

func (*SCronJobManager) AddJobAtIntervals

func (self *SCronJobManager) AddJobAtIntervals(name string, interval time.Duration, jobFunc TCronJobFunction) error

func (*SCronJobManager) AddJobAtIntervalsWithStarTime

func (self *SCronJobManager) AddJobAtIntervalsWithStarTime(name string, interval time.Duration, jobFunc TCronJobFunctionWithStartTime) error

func (*SCronJobManager) AddJobAtIntervalsWithStarTimeStartRun

func (self *SCronJobManager) AddJobAtIntervalsWithStarTimeStartRun(name string, interval time.Duration, jobFunc TCronJobFunctionWithStartTime, startRun bool) error

func (*SCronJobManager) AddJobAtIntervalsWithStartRun

func (self *SCronJobManager) AddJobAtIntervalsWithStartRun(name string, interval time.Duration, jobFunc TCronJobFunction, startRun bool) error

func (*SCronJobManager) AddJobEveryFewDays

func (self *SCronJobManager) AddJobEveryFewDays(name string, day, hour, min, sec int, jobFunc TCronJobFunction, startRun bool) error

func (*SCronJobManager) AddJobEveryFewHour

func (self *SCronJobManager) AddJobEveryFewHour(name string, hour, min, sec int, jobFunc TCronJobFunction, startRun bool) error

func (*SCronJobManager) IsNameUnique

func (self *SCronJobManager) IsNameUnique(name string) bool

func (*SCronJobManager) Remove

func (self *SCronJobManager) Remove(name string) error

func (*SCronJobManager) Start

func (self *SCronJobManager) Start()

func (*SCronJobManager) Start2

func (self *SCronJobManager) Start2(ctx context.Context, electObj *elect.Elect)

func (*SCronJobManager) Stop

func (self *SCronJobManager) Stop()

func (*SCronJobManager) String

func (self *SCronJobManager) String() string

type TCronJobFunction

type TCronJobFunction func(ctx context.Context, userCred mcclient.TokenCredential, isStart bool)

type TCronJobFunctionWithStartTime

type TCronJobFunctionWithStartTime func(ctx context.Context, userCred mcclient.TokenCredential, start time.Time, isStart bool)

type Timer1

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

func (*Timer1) Next

func (t *Timer1) Next(now time.Time) time.Time

type Timer2

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

func (*Timer2) Next

func (t *Timer2) Next(now time.Time) time.Time

type TimerHour

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

func (*TimerHour) Next

func (t *TimerHour) Next(now time.Time) time.Time

Jump to

Keyboard shortcuts

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