Documentation ¶
Index ¶
- Constants
- Variables
- func BuildResponse(errno int, msg string, data interface{}) (resp []byte, err error)
- func ExtractJobName(jobKey string) string
- func ExtractKillerName(killerKey string) string
- func ExtractWorkerIP(regKey string) string
- func InitContainer() (err error)
- type Job
- type JobEvent
- type JobExecuteInfo
- type JobExecuteResult
- type JobLog
- type JobLogFilter
- type JobSchedulePlan
- type LogBatch
- type Response
- type SortLogByStartTime
Constants ¶
View Source
const ( API_JOB_LIST string = "/job" // GET API_JOB_CREATE = "/job" // POST API_JOB_DELETE = "/job/{name}" // DELETE API_JOB_FETCH = "/job/{name}" // GET API_JOB_KILL = "/job/{name}" // PUT API_JOB_LOG = "/job/log" // GET API_WORK_LIST = "/worker" // GET )
View Source
const ( JOB_SAVE_DIR string = "/cron/jobs/" JOB_KILLER_DIR = "/cron/killer/" JOB_LOCK_DIR = "/cron/lock/" JOB_WORKER_DIR = "/cron/workers/" )
View Source
const ( JOB_EVENT_DELETE = iota // 删除任务事件 JOB_EVENT_SAVE // 保存任务事件 JOB_EVENT_KILL // 强杀任务事件 )
Variables ¶
View Source
var ( ERROR_LOCK_ALREADY_REQUIRED = errors.New("The Lock has been occupied!") ERROR_NO_LOCAL_IP_FOUND = errors.New("Nic IP not found! ") )
View Source
var (
Manage *utils.Container
)
Functions ¶
func BuildResponse ¶
func ExtractJobName ¶
func ExtractKillerName ¶
func ExtractWorkerIP ¶
func InitContainer ¶
func InitContainer() (err error)
Types ¶
type Job ¶
type JobEvent ¶
func BuildJobEvent ¶
type JobExecuteInfo ¶
type JobExecuteInfo struct { Job *Job // the job information PlanTime time.Time // the plan scheduled time RealTime time.Time // the real scheduled time CancelCtx context.Context // the job command is context CancelFunc context.CancelFunc // the cancel command func }
func BuildJobExecuteInfo ¶
func BuildJobExecuteInfo(jobSchedulePlan *JobSchedulePlan) (jobExecuteInfo *JobExecuteInfo)
type JobExecuteResult ¶
type JobLog ¶
type JobLog struct { JobName string `json:"jobName" bson:"jobName"` Command string `json:"command" bson:"command"` Err string `json:"err" bson:"err"` Output string `json:"output" bson:"output"` PlanTime int64 `json:"planTime" bson:"planTime"` ScheduleTime int64 `json:"scheduleTime" bson:"scheduleTime"` StartTime int64 `json:"startTime" bson:"startTime"` EndTime int64 `json:"endTime" bson:"endTime"` }
type JobLogFilter ¶
type JobLogFilter struct {
JobName string `bson:"jobName"`
}
type JobSchedulePlan ¶
type JobSchedulePlan struct { Job *Job // the job information Expr *cronexpr.Expression // the cron expr NextTime time.Time // the next scheduled time }
func BuildJobSchedulePlan ¶
func BuildJobSchedulePlan(job *Job) (jobSchedulePlan *JobSchedulePlan, err error)
type SortLogByStartTime ¶
type SortLogByStartTime struct {
SortOrder int `bson:"startTime"`
}
Click to show internal directories.
Click to hide internal directories.