Documentation
¶
Index ¶
Constants ¶
View Source
const LockerPluginName = "cron.locker"
View Source
const PluginName = "cron"
Variables ¶
View Source
var ErrExpressionEmpty = errors.New("expression is empty")
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
MaxConcurrentJobs int `mapstructure:"max_concurrent_jobs" json:"max_concurrent_jobs,omitempty" bson:"max_concurrent_jobs,omitempty"`
TagsUnique bool `mapstructure:"tags_unique" json:"tags_unique,omitempty" bson:"tags_unique,omitempty"`
WaitForScheduleAll bool `mapstructure:"wait_for_schedule_all" json:"wait_for_schedule_all,omitempty" bson:"wait_for_schedule_all,omitempty"`
WaitForSchedule bool `mapstructure:"wait_for_schedule" json:"wait_for_schedule,omitempty" bson:"wait_for_schedule,omitempty"`
}
func (*Config) InitDefaults ¶
func (c *Config) InitDefaults()
type Configurer ¶
type LockerConfig ¶
type LockerConfig struct {
// Tries can be used to set the number of times lock acquire is attempted.
Tries *int `mapstructure:"tries" json:"tries,omitempty" bson:"tries,omitempty"`
// DriftFactor can be used to set the clock drift factor.
DriftFactor *float64 `mapstructure:"drift_factor" json:"drift_factor,omitempty" bson:"drift_factor,omitempty"`
// TimeoutFactor can be used to set the timeout factor.
TimeoutFactor *float64 `mapstructure:"timeout_factor" json:"timeout_factor,omitempty" bson:"timeout_factor,omitempty"`
// Expiry can be used to set the expiry of a mutex to the given value.
Expiry *time.Duration `mapstructure:"expiry" json:"expiry,omitempty" bson:"expiry,omitempty"`
// RetryDelay can be used to set the amount of time to wait between retries.
RetryDelay *time.Duration `mapstructure:"retry_delay" json:"retry_delay,omitempty" bson:"retry_delay,omitempty"`
}
func (*LockerConfig) InitDefaults ¶
func (c *LockerConfig) InitDefaults()
func (*LockerConfig) Options ¶
func (c *LockerConfig) Options() []redsync.Option
type LockerPlugin ¶
type LockerPlugin struct {
// contains filtered or unexported fields
}
func (*LockerPlugin) Init ¶
func (p *LockerPlugin) Init(cfg Configurer, maker RedisMaker, scheduler Scheduler) error
func (*LockerPlugin) Name ¶
func (p *LockerPlugin) Name() string
func (*LockerPlugin) Serve ¶
func (p *LockerPlugin) Serve() chan error
type RedisMaker ¶
type RedisMaker interface {
MakeRedis(name string) (redis.UniversalClient, error)
}
type Scheduler ¶
type Scheduler interface {
WithDistributedLocker(locker gocron.Locker)
StartAsync()
Stop()
IsRunning() bool
Jobs() []*gocron.Job
GetAllTags() []string
Remove(jobFun interface{})
RemoveByReference(job *gocron.Job)
RemoveByTag(tag string) error
RemoveByTags(tags ...string) error
RemoveByTagsAny(tags ...string) error
FindJobsByTag(tags ...string) ([]*gocron.Job, error)
TaskPresent(jobFun interface{}) bool
Clear()
RegisterEventListeners(eventListeners ...gocron.EventListener)
UpdateJob(job *gocron.Job) error
AddTask(expression string, jobFun interface{}, name string, tags ...string) (*gocron.Job, error)
}
type TaskWrapper ¶
type TaskWrapper struct {
// contains filtered or unexported fields
}
func NewTaskWrapper ¶
func NewTaskWrapper(name, expression string, execute func(job gocron.Job) error) *TaskWrapper
func (*TaskWrapper) AddTags ¶
func (t *TaskWrapper) AddTags(tags ...string) *TaskWrapper
func (*TaskWrapper) Expression ¶
func (t *TaskWrapper) Expression() string
func (*TaskWrapper) Name ¶
func (t *TaskWrapper) Name() string
func (*TaskWrapper) SetTags ¶
func (t *TaskWrapper) SetTags(tags ...string) *TaskWrapper
func (*TaskWrapper) Tags ¶
func (t *TaskWrapper) Tags() []string
type TasksWrapper ¶
type TasksWrapper struct {
// contains filtered or unexported fields
}
func NewTasksWrapper ¶
func NewTasksWrapper(tasks ...interface{}) TasksWrapper
func (TasksWrapper) Tasks ¶
func (t TasksWrapper) Tasks() []interface{}
Click to show internal directories.
Click to hide internal directories.