Documentation ¶
Index ¶
- type Iterator
- type Job
- type MemIterator
- type MemStoreDriver
- func (m *MemStoreDriver) Close() error
- func (m *MemStoreDriver) Delete(jobID int64) (err error)
- func (m *MemStoreDriver) Get(jobID int64) (job Job, err error)
- func (m *MemStoreDriver) GetOne(Func, name string) (job Job, err error)
- func (m *MemStoreDriver) NewIterator(Func []byte) Iterator
- func (m *MemStoreDriver) Save(job *Job, force ...bool) (err error)
- type StoreDriver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Iterator ¶
type Iterator interface { // Next advances the iterator to the next value, which will then be available through // then the Value method. It returns false if no further advancement is possible. Next() bool // Value returns the current job. Value() Job // Error returns the current error. Error() error // Close the iterator Close() }
Iterator define the job iterator interface
type Job ¶
type Job struct { ID int64 `json:"job_id"` Name string `json:"name"` // The job name, this is unique. Func string `json:"func"` // The job function reffer on worker function Args string `json:"workload"` // Job args Timeout int64 `json:"timeout"` // Job processing timeout SchedAt int64 `json:"sched_at"` // When to sched the job. RunAt int64 `json:"run_at"` // The job is start at Counter int64 `json:"counter"` // The job run counter Status string `json:"status"` }
Job workload.
type MemIterator ¶
type MemIterator struct {
// contains filtered or unexported fields
}
MemIterator define a memory store driver iterator
func (*MemIterator) Next ¶
func (iter *MemIterator) Next() bool
Next advances the iterator to the next value, which will then be available through then the Value method. It returns false if no further advancement is possible.
type MemStoreDriver ¶
type MemStoreDriver struct {
// contains filtered or unexported fields
}
MemStoreDriver defined a memory store driver
func NewMemStroeDriver ¶
func NewMemStroeDriver() *MemStoreDriver
NewMemStroeDriver create a memory store driver
func (*MemStoreDriver) Delete ¶
func (m *MemStoreDriver) Delete(jobID int64) (err error)
Delete a job with job id.
func (*MemStoreDriver) Get ¶
func (m *MemStoreDriver) Get(jobID int64) (job Job, err error)
Get a job with job id.
func (*MemStoreDriver) GetOne ¶
func (m *MemStoreDriver) GetOne(Func, name string) (job Job, err error)
GetOne get a job with func and name.
func (*MemStoreDriver) NewIterator ¶
func (m *MemStoreDriver) NewIterator(Func []byte) Iterator
NewIterator create a job Iterator with func or nil.
type StoreDriver ¶
type StoreDriver interface { // Save job. when job is exists update it, other create one. Save(*Job, ...bool) error // Delete a job with job id. Delete(jobID int64) error // Get a job with job id. Get(jobID int64) (Job, error) // GetOne get a job with func and name. GetOne(string, string) (Job, error) // NewIterator create a job Iterator with func or nil. NewIterator([]byte) Iterator // Close the driver Close() error }
StoreDriver define the general store interface.
Click to show internal directories.
Click to hide internal directories.