Documentation
¶
Index ¶
- func Add(name string, job Job) error
- func Disable(name string) error
- func Enable(name string) error
- func ListJobs() map[string]Job
- func Remove(name string) error
- type Config
- type Connection
- type Driver
- type Instance
- type Job
- type Jobs
- type Log
- type Module
- func (m *Module) Close()
- func (m *Module) Config(global Map)
- func (m *Module) Delete(name string) error
- func (m *Module) Disable(name string) error
- func (m *Module) Enable(name string) error
- func (m *Module) ListLogs(jobName string, offset, limit int) (int64, []Log)
- func (m *Module) Open()
- func (m *Module) Register(name string, value Any)
- func (m *Module) RegisterConfig(config Config)
- func (m *Module) RegisterDriver(name string, driver Driver)
- func (m *Module) RegisterJob(name string, job Job)
- func (m *Module) RegisterJobs(jobs Jobs)
- func (m *Module) Setup()
- func (m *Module) Start()
- func (m *Module) Stop()
- func (m *Module) Upsert(name string, job Job) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Connection ¶ added in v0.7.0
type Connection interface {
Open() error
Close() error
// Add stores or updates one job definition.
Add(name string, job Job) error
// Enable marks one job as enabled.
Enable(name string) error
// Disable marks one job as disabled.
Disable(name string) error
// Remove deletes one job definition.
Remove(name string) error
// List returns all persisted job definitions.
List() (map[string]Job, error)
// Append writes one execution log entry.
AppendLog(log Log) error
// History returns logs of one job, with total count and paged results.
History(jobName string, offset, limit int) (int64, []Log, error)
// Lock tries to acquire a distributed lock key with ttl.
// It returns true when lock is acquired, false when already locked.
Lock(key string, ttl time.Duration) (bool, error)
}
type Driver ¶ added in v0.7.0
type Driver interface {
Connection(*Instance) (Connection, error)
}
type Job ¶
type Job struct {
Name string `json:"name"`
Desc string `json:"desc"`
Target string `json:"target"`
Schedule string `json:"schedule"`
Schedules []string `json:"schedules"`
Disabled bool `json:"disabled"`
Payload Map `json:"payload"`
Setting Map `json:"setting"`
}
func (Job) RegistryComponent ¶ added in v0.7.0
type Jobs ¶ added in v0.7.0
func (Jobs) RegistryComponent ¶ added in v0.7.0
type Log ¶ added in v0.7.0
type Log struct {
Job string `json:"job"`
Schedule string `json:"schedule"`
Target string `json:"target"`
Payload Map `json:"payload"`
Triggered time.Time `json:"triggered"`
Started time.Time `json:"started"`
Ended time.Time `json:"ended"`
Success bool `json:"success"`
State string `json:"state"`
Error string `json:"error"`
}
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
func (*Module) RegisterConfig ¶ added in v0.7.0
func (*Module) RegisterDriver ¶ added in v0.7.0
func (*Module) RegisterJob ¶ added in v0.7.0
func (*Module) RegisterJobs ¶ added in v0.7.0
Click to show internal directories.
Click to hide internal directories.