Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Appoint ¶
type Appoint struct { // Time is the task execute time. Time time.Time // contains filtered or unexported fields }
Appoint used to perform the task at a specified time.
type Crontab ¶
type Crontab struct {
// contains filtered or unexported fields
}
type Interval ¶
type Interval struct { // Begin is the start time of the validity period of the job. // Zero means no limited. Begin time.Time // End is the end time of the validity period of the job. // Zero means no limited. End time.Time // Interval is the time interval between each task. // The value cannot less than 10ms. Interval time.Duration }
Interval represents a periodic task with fixed interval
type JobChain ¶
type JobChain []JobWrapper
JobChain is a sequence of JobWrapper that decorates submitted jobs with
type JobWrapper ¶
func WrapJobBlockIfRunning ¶
func WrapJobBlockIfRunning() JobWrapper
WrapJobBlockIfRunning implements a JobWrapper to block an invocation of the job util the previous one is completed.
func WrapJobRecover ¶
func WrapJobRecover() JobWrapper
WrapJobRecover implements a JobWrapper to recover when Job run panics.
func WrapJobRetry ¶
WrapJobRetry implements a JobWrapper to retry Run when any error. The limit < 0 means no limited. The interval not allowed must be greater than 0.
func WrapJobSkipIfRunning ¶
func WrapJobSkipIfRunning() JobWrapper
WrapJobSkipIfRunning implements a JobWrapper to skip an invocation of the Job if previous invocation is still running.
func WrapJobWaitGroup ¶
func WrapJobWaitGroup(wg *sync.WaitGroup) JobWrapper
WrapJobWaitGroup implements a JobWrapper to track the completion of job with sync.WaitGroup.
type Option ¶
type Option func(cron *Crontab)
Option represents a modification to the default behavior of a Cron.
func WithJobChain ¶
WithJobChain overwrite the jobChain.
func WithJobWrapper ¶
func WithJobWrapper(w ...JobWrapper) Option
WithJobWrapper append JobWrapper into jobChain
func WithTimezone ¶
WithTimezone reset the timezone in Cron.
type ScheduleFunc ¶
type ScheduleFunc = timewheel.ScheduleFunc
type Task ¶
type Task struct { // Value is the arguments used with callback function. Value interface{} // Callback called when job expired. Callback func(ctx context.Context, value interface{}) error }
Task represents a Job implementation.
type UnixCron ¶
type UnixCron struct { // Begin is the start time of the validity period of the job. // Zero means no limited. Begin time.Time // End is the end time of the validity period of the job. // Zero means no limited. End time.Time // Express is the crontab express specification. // Notice: It will panics if express is invalid. Express string // contains filtered or unexported fields }
UnixCron represents a periodic task with standard unix crontab expression.