Documentation ¶
Overview ¶
reference: https://github.com/seomoz/qless-py
This worker does not model the way qless does it. I more or less modeled it after my own needs.
Index ¶
- Variables
- func Bool(reply interface{}, err error) (bool, error)
- func GetCurrentDir() (string, error)
- type Client
- func (c *Client) Close()
- func (c *Client) Completed(start, count int) ([]string, error)
- func (c *Client) Do(name string, keysAndArgs ...interface{}) (interface{}, error)
- func (c *Client) Events() *Events
- func (c *Client) Get(jid string) (interface{}, error)
- func (c *Client) GetConfig(option string) (string, error)
- func (c *Client) GetJob(jid string) (*Job, error)
- func (c *Client) GetRecurringJob(jid string) (*RecurringJob, error)
- func (c *Client) Queue(name string) *Queue
- func (c *Client) Queues(name string) ([]*Queue, error)
- func (c *Client) SetConfig(option string, value interface{})
- func (c *Client) Tagged(tag string, start, count int) (*TaggedReply, error)
- func (c *Client) Track(jid string) (bool, error)
- func (c *Client) Tracked() (string, error)
- func (c *Client) UnsetConfig(option string)
- func (c *Client) Untrack(jid string) (bool, error)
- type Events
- type History
- type Job
- func (j *Job) Cancel()
- func (j *Job) Client() *Client
- func (j *Job) Complete() (string, error)
- func (j *Job) CompleteWithNoData() (string, error)
- func (j *Job) Depend(jids ...interface{}) (string, error)
- func (j *Job) Fail(typ, message string) (bool, error)
- func (j *Job) Heartbeat() (bool, error)
- func (j *Job) HeartbeatWithNoData() (bool, error)
- func (j *Job) Move(queueName string) (string, error)
- func (j *Job) Retry(delay int) (int, error)
- func (j *Job) SetClient(cli *Client)
- func (j *Job) Tag(tags ...interface{}) (string, error)
- func (j *Job) Track() (bool, error)
- func (j *Job) Undepend(jids ...interface{}) (string, error)
- func (j *Job) Untag(tags ...interface{}) (string, error)
- func (j *Job) Untrack() (bool, error)
- type JobCallback
- type JobFunc
- type Lua
- type Queue
- func (q *Queue) CancelAll()
- func (q *Queue) Jobs(state string, start, count int) ([]string, error)
- func (q *Queue) Pause()
- func (q *Queue) Pop(count int) ([]*Job, error)
- func (q *Queue) Put(jid, klass string, data interface{}, delay, priority int, tags []string, ...) (string, error)
- func (q *Queue) Recur(jid, klass string, data interface{}, interval, offset, priority int, ...) (string, error)
- func (q *Queue) SetClient(cli *Client)
- func (q *Queue) Unpause()
- type RecurringJob
- type StringSlice
- type TaggedReply
- type Worker
Constants ¶
This section is empty.
Variables ¶
View Source
var (
JOBSTATES = []string{"stalled", "running", "scheduled", "depends", "recurring"}
)
Functions ¶
func Bool ¶
Bool is a helper that converts a command reply to a boolean. If err is not equal to nil, then Bool returns false, err. Otherwise Bool converts the reply to boolean as follows:
Reply type Result integer value != 0, nil bulk strconv.ParseBool(reply) or r != "False", nil nil false, ErrNil other false, error
func GetCurrentDir ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GetRecurringJob ¶
func (c *Client) GetRecurringJob(jid string) (*RecurringJob, error)
func (*Client) UnsetConfig ¶
type Events ¶
type Events struct {
// contains filtered or unexported fields
}
func (*Events) Unsubscribe ¶
func (e *Events) Unsubscribe()
type Job ¶
type Job struct { Jid string Klass string State string Queue string Worker string Tracked bool Priority int Expires int64 Retries int Remaining int Data interface{} Tags StringSlice History []History Failure interface{} Dependents StringSlice Dependencies interface{} // contains filtered or unexported fields }
func (*Job) CompleteWithNoData ¶
for big job, save memory in redis
func (*Job) HeartbeatWithNoData ¶
type JobCallback ¶
type Lua ¶
type Lua struct {
// contains filtered or unexported fields
}
func (*Lua) LoadScripts ¶
loads all the given scripts from the path
type Queue ¶
type Queue struct { Running int Name string Waiting int Recurring int Depends int Stalled int Scheduled int // contains filtered or unexported fields }
func (*Queue) Put ¶
func (q *Queue) Put(jid, klass string, data interface{}, delay, priority int, tags []string, retries int, depends []string) (string, error)
Puts a job into the queue returns jid, error
type RecurringJob ¶
type RecurringJob struct { Tags StringSlice Jid string Retries int Data interface{} Queue string Interval int Count int Klass string Priority int // contains filtered or unexported fields }
func NewRecurringJob ¶
func NewRecurringJob(cli *Client) *RecurringJob
func (*RecurringJob) Cancel ¶
func (r *RecurringJob) Cancel()
func (*RecurringJob) Tag ¶
func (r *RecurringJob) Tag(tags ...interface{})
func (*RecurringJob) Untag ¶
func (r *RecurringJob) Untag(tags ...interface{})
func (*RecurringJob) Update ¶
func (r *RecurringJob) Update(opts map[string]interface{})
example: job.Update(map[string]interface{}{"priority": 5}) options:
priority int retries int interval int data interface{} klass string
type StringSlice ¶
type StringSlice []string
represents a string slice with special json unmarshalling
func (*StringSlice) UnmarshalJSON ¶
func (s *StringSlice) UnmarshalJSON(data []byte) error
type TaggedReply ¶
type TaggedReply struct { Total int Jobs StringSlice }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.