Documentation ¶
Index ¶
- Constants
- Variables
- func AddNotifyAddr(addr string)
- func Count() int
- func Init(localIP string)
- func NotifyAddrs() []string
- func Once(job *Job) string
- func ParseIPFromID(id string) (string, error)
- func RawOnce(name string, args FuncArg) (string, error)
- func Register(name string, f Func) error
- func RemoveNotifyAddr(addr string)
- func Sleep(ID string, sleep bool)
- func Start()
- func Status() string
- func Stop()
- func Update(jobs []Job, version string) error
- func Version() string
- type Crond
- func (cd *Crond) Count() int
- func (cd *Crond) Entries(query map[string]string) []EntrySpec
- func (cd *Crond) Find(name string, args FuncArg) (*Job, error)
- func (cd *Crond) FindById(id string) (*Job, error)
- func (cd *Crond) Once(job *Job) string
- func (cd *Crond) RawOnce(name string, args FuncArg) (string, error)
- func (cd *Crond) Register(name string, f Func) error
- func (cd *Crond) Sleep(ID string, sleep bool)
- func (cd *Crond) Start()
- func (cd *Crond) Stop()
- func (cd *Crond) Update(jobs []Job, version string) error
- func (cd *Crond) WrapFunc(job *Job, rid string) func()
- type EntrySpec
- type Func
- type FuncArg
- type FuncResult
- type Job
- type JobRecord
- type JobState
- type JobType
Constants ¶
View Source
const ( StateRunning = "running" StateSuccess = "success" StateFail = "failed" TypeCron = "cron" TypeOnce = "once" )
Variables ¶
View Source
var (
RunningCount int32 = 0
)
Functions ¶
func AddNotifyAddr ¶
func AddNotifyAddr(addr string)
func NotifyAddrs ¶
func NotifyAddrs() []string
func ParseIPFromID ¶
func RemoveNotifyAddr ¶
func RemoveNotifyAddr(addr string)
Types ¶
type Crond ¶
type Crond struct { Version string // contains filtered or unexported fields }
type EntrySpec ¶
type Func ¶
type Func func(FuncArg) (FuncResult, error)
Cron task's func type and arg type and result type
type FuncResult ¶
type FuncResult map[string]interface{}
type Job ¶
type Job struct { ID string `json:"id"` Spec string `json:"spec"` // string like "0 0 * * *" Action string `json:"action"` // task's name Args FuncArg `json:"args"` Type JobType `json:"type"` // cronJob or onceJob Sleep bool `json:"sleep"` // contains filtered or unexported fields }
func (*Job) GenerateID ¶
Click to show internal directories.
Click to hide internal directories.