qless

package module
v0.0.0-...-06d5033 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2019 License: MIT Imports: 20 Imported by: 0

README

go-qless

This is a work-in-progress update of goqless and is only minimally tested. Initial work has been done to support queueing jobs for other workers

Documentation

Overview

reference: https://github.com/seomoz/qless-py

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(reply interface{}, err error) (bool, error)

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 DialConnectTimeout

func DialConnectTimeout(v time.Duration) dialOptionFn

func DialDatabase

func DialDatabase(v int) dialOptionFn

DialDatabase specifies the database to select when establishing a new connection

func DialIdleTimeout

func DialIdleTimeout(v time.Duration) dialOptionFn

func DialMaxActive

func DialMaxActive(v int) dialOptionFn

func DialMaxIdle

func DialMaxIdle(v int) dialOptionFn

DialMaxIdle specifies the maximum number of idle connections in the pool

func DialMinPingInterval

func DialMinPingInterval(v time.Duration) dialOptionFn

func IsJobLost

func IsJobLost(err error) bool

func WithDelay

func WithDelay(v int) putOptionFn

func WithDepends

func WithDepends(v ...string) putOptionFn

func WithInterval

func WithInterval(v float32) putOptionFn

func WithJID

func WithJID(v string) putOptionFn

func WithPriority

func WithPriority(v int) putOptionFn

func WithResources

func WithResources(v ...string) putOptionFn

func WithRetries

func WithRetries(v int) putOptionFn

func WithTags

func WithTags(v ...string) putOptionFn

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func Dial

func Dial(host, port string, opts ...dialOptionFn) (*Client, error)

func NewClient

func NewClient(pool *redis.Pool) *Client

func (*Client) Close

func (c *Client) Close()

func (*Client) Completed

func (c *Client) Completed(start, count int) ([]string, error)

func (*Client) Do

func (c *Client) Do(args ...interface{}) (interface{}, error)

func (*Client) Events

func (c *Client) Events() *Events

func (*Client) Get

func (c *Client) Get(jid string) (interface{}, error)

func (*Client) GetConfig

func (c *Client) GetConfig(option string) (string, error)

func (*Client) GetJob

func (c *Client) GetJob(jid string) (Job, error)

func (*Client) GetRecurringJob

func (c *Client) GetRecurringJob(jid string) (*RecurringJob, error)

func (*Client) Queue

func (c *Client) Queue(name string) Queue

func (*Client) Queues

func (c *Client) Queues() (queues []Queue, err error)

func (*Client) SetConfig

func (c *Client) SetConfig(option string, value interface{})

func (*Client) Tagged

func (c *Client) Tagged(tag string, start, count int) (*TaggedReply, error)

func (*Client) Track

func (c *Client) Track(jid string) (bool, error)

Track the jid

func (*Client) Tracked

func (c *Client) Tracked() (string, error)

Returns all the tracked jobs

func (*Client) UnsetConfig

func (c *Client) UnsetConfig(option string)

func (*Client) Untrack

func (c *Client) Untrack(jid string) (bool, error)

Untrack the jid

type CommandError

type CommandError struct {
	Line    int
	Area    string
	Message string
	// contains filtered or unexported fields
}

func (*CommandError) Error

func (e *CommandError) Error() string

type Events

type Events struct {
	// contains filtered or unexported fields
}

func (*Events) Close

func (e *Events) Close()

func (*Events) Subscribe

func (e *Events) Subscribe(ch chan<- interface{}) error

func (*Events) Unsubscribe

func (e *Events) Unsubscribe(ch chan<- interface{})

type Failure

type Failure struct {
	Group   string `json:"group"`
	Message string `json:"message"`
	When    int64  `json:"when"`
	Worker  string `json:"worker"`
}

func (Failure) MarshalEasyJSON

func (v Failure) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Failure) MarshalJSON

func (v Failure) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Failure) UnmarshalEasyJSON

func (v *Failure) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Failure) UnmarshalJSON

func (v *Failure) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type History

type History struct {
	When   int64  `json:"when"`
	Queue  string `json:"q"`
	What   string `json:"what"`
	Worker string `json:"worker"`
}

func (History) MarshalEasyJSON

func (v History) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (History) MarshalJSON

func (v History) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*History) UnmarshalEasyJSON

func (v *History) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*History) UnmarshalJSON

func (v *History) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Job

type Job interface {
	JID() string
	Class() string
	State() string
	Queue() string
	Worker() string
	Tracked() bool
	Priority() int
	Expires() int64
	TTL() int64
	Retries() int
	Remaining() int
	Data() string
	UnmarshalData(v interface{}) error
	Tags() []string
	History() []History
	Failure() *Failure
	Dependents() []string
	Dependencies() []string

	// operations
	Heartbeat() (bool, error)
	Fail(group, message string) (bool, error)
	Complete() (string, error)
	CompleteWithNoData() (string, error)
	HeartbeatWithNoData() (bool, error)
	Cancel()
	Retry(delay int) (int, error)
}

type Queue

type Queue interface {
	Name() string
	Info() QueueInfo
	Jobs(state string, start, count int) ([]string, error)
	CancelAll()
	Pause()
	Resume()
	Put(class string, data interface{}, opt ...putOptionFn) (string, error)
	PutOrReplace(class string, jid string, data interface{}, opt ...putOptionFn) (int64, error)
	PopOne() (j Job, err error)
	Pop(count int) ([]Job, error)
	Recur(class string, data interface{}, interval int, opt ...putOptionFn) (string, error)
	Len() (int64, error)
	Stats(time.Time) (*QueueStatistics, error)
}

type QueueInfo

type QueueInfo struct {
	Name      string `json:"name"`
	Paused    bool   `json:"paused"`
	Waiting   int    `json:"waiting"`
	Running   int    `json:"running"`
	Stalled   int    `json:"stalled"`
	Scheduled int    `json:"scheduled"`
	Recurring int    `json:"recurring"`
	Depends   int    `json:"depends"`
}

func (QueueInfo) MarshalEasyJSON

func (v QueueInfo) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (QueueInfo) MarshalJSON

func (v QueueInfo) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*QueueInfo) UnmarshalEasyJSON

func (v *QueueInfo) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*QueueInfo) UnmarshalJSON

func (v *QueueInfo) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type QueueStatistics

type QueueStatistics struct {
	Failed   int64    `json:"failed"`
	Failures int64    `json:"failures"`
	Retries  int64    `json:"retries"`
	Run      StatData `json:"run"`
	Wait     StatData `json:"wait"`
}

func (QueueStatistics) MarshalEasyJSON

func (v QueueStatistics) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (QueueStatistics) MarshalJSON

func (v QueueStatistics) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*QueueStatistics) UnmarshalEasyJSON

func (v *QueueStatistics) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*QueueStatistics) UnmarshalJSON

func (v *QueueStatistics) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

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 (*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{})

type Resource

type Resource interface {
	Exists() bool
}

type StatData

type StatData struct {
	Count     int64   `json:"count"`
	Histogram []int64 `json:"histogram"`
	Mean      float64 `json:"mean"`
	Std       float64 `json:"std"`
}

func (StatData) MarshalEasyJSON

func (v StatData) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (StatData) MarshalJSON

func (v StatData) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*StatData) UnmarshalEasyJSON

func (v *StatData) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*StatData) UnmarshalJSON

func (v *StatData) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

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
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL