Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( AddEvent = "add" DeleteEvent = "delete" KillEvent = "kill" )
Functions ¶
This section is empty.
Types ¶
type Execute ¶
type Execute interface {
Execute(ctx *ExecuteContext) error
}
type ExecuteContext ¶
type IStore ¶
type IStore interface { Save(job *Job) error Delete(job *Job) error Lock(job *ExecuteContext) error UnLock(job *ExecuteContext) error Load() ([]*Job, error) Watch(WatchFunc) }
IStore 存储
type Job ¶
type Job struct { ExecuteKey string `json:"execute_key"` //执行器的key Key string `json:"key"` //脚本主键 Data []byte `json:"data"` //脚本实体 CronExpr string `json:"cron_expr"` //触发表达式 }
Job 脚本实体
func (*Job) WithCronTime ¶
func (*Job) WithStructToData ¶
func (j *Job) WithStructToData(data interface{})
type Manage ¶
type Manage struct { Store IStore // contains filtered or unexported fields }
Manage 脚本管理
type Memory ¶
type Memory struct {
// contains filtered or unexported fields
}
func (*Memory) Lock ¶
func (m *Memory) Lock(ex *ExecuteContext) error
func (*Memory) UnLock ¶
func (m *Memory) UnLock(ex *ExecuteContext) error
type RedisStore ¶
type RedisStore struct {
// contains filtered or unexported fields
}
func NewRedisStore ¶
func NewRedisStore(address string, options ...redis.DialOption) (*RedisStore, error)
func (*RedisStore) Delete ¶
func (s *RedisStore) Delete(job *Job) (err error)
func (*RedisStore) Load ¶
func (s *RedisStore) Load() ([]*Job, error)
func (*RedisStore) Lock ¶
func (s *RedisStore) Lock(ex *ExecuteContext) error
func (*RedisStore) Save ¶
func (s *RedisStore) Save(job *Job) error
func (*RedisStore) UnLock ¶
func (s *RedisStore) UnLock(ex *ExecuteContext) error
func (*RedisStore) Watch ¶
func (s *RedisStore) Watch(f WatchFunc)
Click to show internal directories.
Click to hide internal directories.