Documentation
¶
Index ¶
- Variables
- func CheckIfEnabled() cron.JobWrapper
- func CreateSchedule(jobname, schedule string, cmd func(), opts ...ScheduleOptions) error
- func CreateScheduledJob(jobname, schedule string, cmd func() error, opts ...ScheduleOptions) error
- func CreateScheduledJobWithContext(jobname, schedule string, cmd func(ctx context.Context) error, ...) error
- func DoCleanup(settingkey string, tables []string, col string, duration string) interface{}
- func InitDBCronJob(logger *zap.Logger, db *gorm.DB) (core.Startup, error)
- func InitScheduleCleanupJob(settingkey string) interface{}
- func IsLeader() bool
- func List() []string
- func Run(jobname string) (err error)
- func Withhistory(jobname string) cron.JobWrapper
- type CleanupService
- type DBCleanupReq
- type DBCronJob
- type JobHistory
- type JobHistoryProvider
- type LeaderElection
- type LeaderElectionConfig
- type ScheduleOptions
- type ScheduledJob
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Deprecated: ScheduleLockerEnabled is deprecated and ignored. ScheduleLockerEnabled = true JobHistoryEnabled = true ScheduleDisabled = false JobRecoveryEnabled = true )
View Source
var JobHistoryAdaptor = core.NewChanAdaptor[JobHistory](1000)
Functions ¶
func CheckIfEnabled ¶ added in v0.8.6
func CheckIfEnabled() cron.JobWrapper
func CreateSchedule ¶
func CreateSchedule(jobname, schedule string, cmd func(), opts ...ScheduleOptions) error
func CreateScheduledJob ¶ added in v0.11.3
func CreateScheduledJob(jobname, schedule string, cmd func() error, opts ...ScheduleOptions) error
func CreateScheduledJobWithContext ¶ added in v0.11.8
func InitDBCronJob ¶ added in v0.8.0
func InitScheduleCleanupJob ¶ added in v0.8.0
func InitScheduleCleanupJob(settingkey string) interface{}
func Withhistory ¶ added in v0.8.1
func Withhistory(jobname string) cron.JobWrapper
decrepted, will be removed next release.
Types ¶
type CleanupService ¶ added in v0.8.0
func (*CleanupService) Cleanup ¶ added in v0.8.0
func (cs *CleanupService) Cleanup(req *DBCleanupReq) error
func (*CleanupService) GetDefaultRequest ¶ added in v0.8.0
func (cs *CleanupService) GetDefaultRequest() *DBCleanupReq
func (*CleanupService) RegConnection ¶ added in v0.8.0
func (cs *CleanupService) RegConnection(name string, db *gorm.DB)
type DBCleanupReq ¶ added in v0.8.0
type JobHistory ¶ added in v0.8.1
type JobHistory struct {
App string
Job string
Start time.Time
Finished time.Time
Duration time.Duration
Succeed bool
Message string
}
func GetLastDoneJobHistory ¶ added in v0.10.6
func GetLastDoneJobHistory(jobname string) *JobHistory
type JobHistoryProvider ¶ added in v0.10.6
func (*JobHistoryProvider) GetLastDoneJobHistory ¶ added in v0.10.6
func (p *JobHistoryProvider) GetLastDoneJobHistory(jobname string) *JobHistory
func (*JobHistoryProvider) SetJobhistory ¶ added in v0.10.6
func (p *JobHistoryProvider) SetJobhistory(h JobHistory)
type LeaderElection ¶ added in v0.12.3
type LeaderElection struct {
// contains filtered or unexported fields
}
LeaderElection manages leader election process
func NewLeaderElection ¶ added in v0.12.3
func NewLeaderElection(client *redis.Client, logger *zap.Logger, cfg *LeaderElectionConfig) *LeaderElection
NewLeaderElection creates a new LeaderElection instance
func (*LeaderElection) GetCandidateID ¶ added in v0.12.3
func (le *LeaderElection) GetCandidateID() string
GetLeaderID returns the candidate ID of this instance
func (*LeaderElection) IsLeader ¶ added in v0.12.3
func (le *LeaderElection) IsLeader() bool
IsLeader returns true if the current instance is the leader
func (*LeaderElection) Start ¶ added in v0.12.3
func (le *LeaderElection) Start()
Start begins the leader election process in background
func (*LeaderElection) Stop ¶ added in v0.12.3
func (le *LeaderElection) Stop()
Stop stops the leader election process
type LeaderElectionConfig ¶ added in v0.12.3
type LeaderElectionConfig struct {
Interval time.Duration `yaml:"interval"`
TTL time.Duration `yaml:"ttl"`
Key string `yaml:"key"`
}
LeaderElectionConfig defines configuration for leader election
type ScheduleOptions ¶ added in v0.10.18
Click to show internal directories.
Click to hide internal directories.