Versions in this module Expand all Collapse all v1 v1.1.0 Jan 24, 2024 Changes in this version + const NodePoolStateSteady + const NodePoolStateUpgrade + var ErrNodePoolIsUpgrading = errors.New("nodePool is upgrading") + type Dcron struct + RecoverFunc RecoverFuncType + ServerName string + func NewDcron(serverName string, driver driver.DriverV2, cronOpts ...cron.Option) *Dcron + func NewDcronWithOption(serverName string, driver driver.DriverV2, dcronOpts ...Option) *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) NodeID() string + 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 interface + CheckJobAvailable func(jobName string) (bool, error) + GetLastNodesUpdateTime func() time.Time + GetNodeID func() string + Start func(ctx context.Context) error + Stop func(ctx context.Context) error + func NewNodePool(serviceName string, drv driver.DriverV2, updateDuration time.Duration, ...) INodePool + type IRecentJobPacker interface + AddJob func(jobName string, t time.Time) error + PopAllJobs func() (jobNames []string) + func NewRecentJobPacker(timeWindow time.Duration) IRecentJobPacker + type Job interface + Run func() + type JobWarpper struct + CronStr string + Dcron *Dcron + ID cron.EntryID + Job Job + Name string + func (job JobWarpper) Execute() + func (job JobWarpper) Run() + type JobWithTime struct + JobName string + RunningTime time.Time + type JobWithTimeHeap []JobWithTime + func (jobHeap *JobWithTimeHeap) Index(i int) interface{} + func (jobHeap *JobWithTimeHeap) Len() int + func (jobHeap *JobWithTimeHeap) Less(i, j int) bool + func (jobHeap *JobWithTimeHeap) Pop() (ret interface{}) + func (jobHeap *JobWithTimeHeap) Push(x interface{}) + func (jobHeap *JobWithTimeHeap) Swap(i, j int) + type NodePool struct + func (np *NodePool) CheckJobAvailable(jobName string) (bool, error) + func (np *NodePool) GetLastNodesUpdateTime() time.Time + func (np *NodePool) GetNodeID() string + func (np *NodePool) Start(ctx context.Context) (err error) + func (np *NodePool) Stop(ctx context.Context) error + type Option func(*Dcron) + func CronOptionChain(wrappers ...cron.JobWrapper) Option + func CronOptionLocation(loc *time.Location) Option + func CronOptionParser(p cron.ScheduleParser) Option + func CronOptionSeconds() Option + func WithClusterStable(timeWindow time.Duration) Option + func WithHashReplicas(d int) Option + func WithLogger(logger dlog.Logger) Option + func WithNodeUpdateDuration(d time.Duration) Option + func WithRecoverFunc(recoverFunc RecoverFuncType) Option + type RecentJobPacker struct + func (rjp *RecentJobPacker) AddJob(jobName string, t time.Time) (err error) + func (rjp *RecentJobPacker) PopAllJobs() (jobNames []string) + type RecoverFuncType func(d *Dcron) + type StableJob interface + GetCron func() string + Serialize func() ([]byte, error) + UnSerialize func([]byte) error