Documentation ¶
Index ¶
- func Guid() string
- func RegisterStorage(name string, storage StorageInitFunc)
- type Dispatch
- type DispatchConfigure
- type DispatchStatus
- type EngineConfigure
- type Job
- type JobCallback
- type JobCallbackConfigure
- type JobHandler
- type JobReturn
- type JobState
- type JobStatus
- type Log
- type Storage
- type StorageInitFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterStorage ¶
func RegisterStorage(name string, storage StorageInitFunc)
Types ¶
type Dispatch ¶
func NewDispatch ¶
func NewDispatch(configure *DispatchConfigure) (*Dispatch, error)
func (*Dispatch) RegisterHandler ¶
func (this *Dispatch) RegisterHandler(name string, handler JobHandler)
type DispatchConfigure ¶
type DispatchConfigure struct { Engine string // storage engine name.eg:(redis,sqlite,memory) MaxConcurrency uint32 // max concurrency goroutine MaxReplyCount uint32 // max reply job to job list when job ask need again HeartInterval time.Duration // sleep some time when empty job list DumpInterval time.Duration // not used Logfile string // log file path EngineConfigure EngineConfigure // engine configure Callback JobCallbackConfigure // job callbacks }
configure dispatch
type DispatchStatus ¶
dispatch engine status for monitor
type EngineConfigure ¶
type EngineConfigure map[string]interface{}
func (*EngineConfigure) Get ¶
func (this *EngineConfigure) Get(name string, defaultVal interface{}) interface{}
type Job ¶
type Job struct { Id string //任务id,使用/dev/urandom 获取 Name string //任务名称,调度器注册的任务名称 Param interface{} //任务参数 CreateTime time.Time //任务创建时间 FlushTime time.Time //任务结束时间 Status JobStatus //任务状态 ReplyCount uint32 //重试次数 }
任务 todo 优先队列的支持
func (*Job) MarshalBinary ¶
func (*Job) UnmarshalBinary ¶
type JobCallbackConfigure ¶
type JobCallbackConfigure struct { After JobCallback Before JobCallback }
type JobState ¶
type JobState struct { JobId string Name string Status string Msg string RunTime int WaitTime int ReplyCount int }
func (*JobState) MarshalBinary ¶
func (*JobState) UnmarshalBinary ¶
type Storage ¶
type Storage interface { JobPush(job *Job) error JobPop() (*Job, error) JobFlush() error JobLen() uint32 JobStateUpdate(state *JobState) error JobState(jobId string) (*JobState, error) }
func GetStorage ¶
func GetStorage(name string, configure *DispatchConfigure) (Storage, error)
type StorageInitFunc ¶
type StorageInitFunc func(configure *DispatchConfigure) Storage
Click to show internal directories.
Click to hide internal directories.