Documentation
¶
Index ¶
- Constants
- Variables
- func Close()
- func DeleteJob(name string) error
- func DeleteJobById(id string) error
- func EventJob(id, name, spec, channel string, repetitions int, start bool, params et.Json, ...) error
- func EventStatusDone(data et.Json) error
- func EventStatusFailed(data et.Json) error
- func EventStatusRunning(data et.Json) error
- func IsMaster() bool
- func ListJobs() (et.Items, error)
- func Load() error
- func PushEventJob(id, name, spec, channel string, repetitions int, start bool, params et.Json) error
- func Server() error
- func Start() error
- func StartJob(name string) (int, error)
- func StartJobById(id string) error
- func Stop() error
- func StopJob(name string) error
- func StopJobById(id string) error
- type Job
- type Jobs
Constants ¶
const ( StatusAdded = "added" StatusPending = "pending" StatusStarting = "starting" StatusDone = "done" StatusNotified = "notified" StatusRunning = "running" StatusStopped = "stopped" StatusExecuted = "executed" StatusRemoved = "removed" StatusFailed = "failed" )
Variables ¶
var ( EVENT_CRONTAB_SERVER = "event:crontab:server" EVENT_CRONTAB_SET = "event:crontab:set" EVENT_CRONTAB_STATUS = "event:crontab:status" EVENT_CRONTAB_STOP = "event:crontab:stop" EVENT_CRONTAB_START = "event:crontab:start" EVENT_CRONTAB_DELETE = "event:crontab:delete" EVENT_CRONTAB_FAILED = "event:crontab:failed" )
var (
ErrJobExists = fmt.Errorf("job already exists")
)
Functions ¶
func DeleteJobById ¶
* * DeleteJobById * @param id string * @return error *
func EventJob ¶ added in v0.1.19
func EventJob(id, name, spec, channel string, repetitions int, start bool, params et.Json, fn func(event.Message)) error
* * EventJob * Event job to crontab function execute was notified by event workers * @param id, name, spec, channel string, repetitions int, start bool, params et.Json, fn func(event.Message) * @return *Job, error *
func EventStatusDone ¶ added in v0.1.19
* * EventStatusPending * @param data et.Json * @return error *
func EventStatusFailed ¶ added in v0.1.19
* * EventStatusFailed * @param data et.Json * @return error *
func EventStatusRunning ¶ added in v0.1.19
* * EventStatusRunning * @param data et.Json * @return error *
func PushEventJob ¶ added in v0.1.19
func PushEventJob(id, name, spec, channel string, repetitions int, start bool, params et.Json) error
* * PushEventJob * Push job to crontab was notified by event workers * @param id, name, spec, channel string, repetitions int, start bool, params et.Json * @return error *
func StartJobById ¶
* * StartJobById * @param id string * @return error *
func StopJobById ¶
* * StopJobById * @param id string * @return error *
Types ¶
type Job ¶
type Job struct {
Id string `json:"id"`
Name string `json:"name"`
Channel string `json:"channel"`
Params et.Json `json:"params"`
Spec string `json:"spec"`
Started bool `json:"started"`
Status string `json:"status"`
Idx int `json:"idx"`
NodeId int64 `json:"node_id"`
Attempts int `json:"attempts"`
Repetitions int `json:"repetitions"`
// contains filtered or unexported fields
}
func AddJob ¶
func AddJob(id, name, spec, channel string, params et.Json, repetitions int, start bool, fn func(job *Job)) (*Job, error)
* * AddJob * Add job to crontab in execute local * @param id, name, spec, channel string, params et.Json, repetitions int, start bool, fn func() * @return *Job, error *