Documentation ¶
Index ¶
- type Dcron
- func (d *Dcron) AddFunc(jobName, cronStr string, cmd func()) (err error)
- func (d *Dcron) AddJob(jobName, cronStr string, job Job) (err error)
- func (d *Dcron) GetLogger() dlog.Logger
- func (d *Dcron) Remove(jobName string)
- func (d *Dcron) Run()
- func (d *Dcron) SetLogger(logger dlog.Logger)
- func (d *Dcron) Start()
- func (d *Dcron) Stop()
- type INodePool
- type Job
- type JobWarpper
- type NodePool
- type Option
- func CronOptionChain(wrappers ...cron.JobWrapper) Option
- func CronOptionLocation(loc *time.Location) Option
- func CronOptionParser(p cron.ScheduleParser) Option
- func CronOptionSeconds() Option
- func WithHashReplicas(d int) Option
- func WithLogger(logger dlog.Logger) Option
- func WithNodeUpdateDuration(d time.Duration) Option
- func WithPrintLogInfo() Option
- func WithRecoverFunc(recoverFunc RecoverFuncType) Option
- type RecoverFuncType
- type StableJob
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dcron ¶
type Dcron struct { ServerName string RecoverFunc RecoverFuncType // contains filtered or unexported fields }
Dcron is main struct
func NewDcronWithOption ¶
NewDcronWithOption create a Dcron with Dcron Option
type INodePool ¶
type JobWarpper ¶
type JobWarpper struct { ID cron.EntryID Dcron *Dcron Name string CronStr string Func func() Job Job }
JobWarpper is a job warpper
type NodePool ¶
type NodePool struct {
// contains filtered or unexported fields
}
NodePool is a node pool
func (*NodePool) CheckJobAvailable ¶
Check if this job can be run in this node.
type Option ¶
type Option func(*Dcron)
Option is Dcron Option
func CronOptionChain ¶
func CronOptionChain(wrappers ...cron.JobWrapper) Option
CronOptionChain is Warp cron with chain
func CronOptionLocation ¶
CronOptionLocation is warp cron with location
func CronOptionParser ¶
func CronOptionParser(p cron.ScheduleParser) Option
CronOptionParser is warp cron with schedules.
func CronOptionSeconds ¶
func CronOptionSeconds() Option
CronOptionSeconds is warp cron with seconds
func WithLogger ¶
WithLogger both set dcron and cron logger.
func WithNodeUpdateDuration ¶
WithNodeUpdateDuration set node update duration
func WithRecoverFunc ¶
func WithRecoverFunc(recoverFunc RecoverFuncType) Option
You can defined yourself recover function to make the job will be added to your dcron when the process restart
type RecoverFuncType ¶
type RecoverFuncType func(d *Dcron)
Click to show internal directories.
Click to hide internal directories.