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() interface{ ... }
- func (d *Dcron) Remove(jobName string)
- func (d *Dcron) Run()
- func (d *Dcron) SetLogger(logger *log.Logger)
- func (d *Dcron) Start()
- func (d *Dcron) Stop()
- 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 interface{ ... }) Option
- func WithNodeUpdateDuration(d time.Duration) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dcron ¶
type Dcron struct { ServerName string // contains filtered or unexported fields }
Dcron is main struct
func NewDcronWithOption ¶
NewDcronWithOption create a Dcron with Dcron Option
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 { NodeID string Driver driver.Driver // contains filtered or unexported fields }
NodePool is a node pool
func (*NodePool) PickNodeByJobName ¶
PickNodeByJobName : 使用一致性hash算法根据任务名获取一个执行节点
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
Click to show internal directories.
Click to hide internal directories.