Documentation ¶
Index ¶
- type Config
- type Job
- type MySQLStore
- func (s MySQLStore) AddJob(j Job) Job
- func (s MySQLStore) GetAllJobs() []Job
- func (s MySQLStore) GetDueJobs(t time.Time, cnt int) []Job
- func (s MySQLStore) GetWakeUpTime() (wakeUpTime int)
- func (s MySQLStore) LockJobs(jobs []Job, keepTime int) error
- func (s MySQLStore) LookupJob(ID string) Job
- func (s MySQLStore) RemoveAllJobs() error
- func (s MySQLStore) RemoveJob(j Job) error
- func (s MySQLStore) Start(config *Config)
- func (s MySQLStore) UpdateJob(j Job) error
- type StoreInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Job ¶
type Job struct { ID uint `json:"id" gorm:"primarykey"` JobID string `json:"job_id" gorm:"uniqueIndex;default:''"` FuncName string `json:"func_name" gorm:"index;default:''"` FuncKwargs string `json:"func_kwargs" gorm:"default:''"` SchedTimes int `json:"sched_times" gorm:"default:0"` IncrStep int `json:"incr_step" gorm:"default:3"` NextRunTime int `json:"next_run_time" gorm:"index;default:0"` MaxSchedTimes int `json:"max_sched_times" gorm:"default:0"` CreatedAt int `json:"created_at" gorm:"not null"` UpdatedAt int `json:"updated_at" gorm:"default:0"` DeletedAt int `json:"deleted_at" gorm:"index;default:0"` }
type MySQLStore ¶
type MySQLStore struct{}
func (MySQLStore) AddJob ¶
func (s MySQLStore) AddJob(j Job) Job
func (MySQLStore) GetAllJobs ¶
func (s MySQLStore) GetAllJobs() []Job
func (MySQLStore) GetDueJobs ¶
func (s MySQLStore) GetDueJobs(t time.Time, cnt int) []Job
func (MySQLStore) GetWakeUpTime ¶
func (s MySQLStore) GetWakeUpTime() (wakeUpTime int)
func (MySQLStore) LockJobs ¶
func (s MySQLStore) LockJobs(jobs []Job, keepTime int) error
当前服务实例拉取任务下来上锁避免其他实例重复获取相同的任务 keepTime: 每个协程任务最大的运行时长
func (MySQLStore) LookupJob ¶
func (s MySQLStore) LookupJob(ID string) Job
func (MySQLStore) RemoveAllJobs ¶
func (s MySQLStore) RemoveAllJobs() error
func (MySQLStore) RemoveJob ¶
func (s MySQLStore) RemoveJob(j Job) error
func (MySQLStore) Start ¶
func (s MySQLStore) Start(config *Config)
func (MySQLStore) UpdateJob ¶
func (s MySQLStore) UpdateJob(j Job) error
type StoreInterface ¶
Click to show internal directories.
Click to hide internal directories.