taskqueue

package
v0.0.0-...-41d0ab0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2017 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TimeForever represents a very large duration.
	TimeForever = math.MaxUint32 * time.Second
)

Variables

This section is empty.

Functions

func AddQuestion

func AddQuestion(conn *Connection, token string, locs common.Locations, ttr time.Duration) (qid uint64, err common.Error)

timeLimit = execution time limit ttr = time to run

func DeleteJob

func DeleteJob(conn *Connection, jid uint64) common.Error

func GetAnswer1

func GetAnswer1(conn *Connection, token string) (aid uint64, dr *common.DrivingRoute, err common.Error)

func RegisterGarbage

func RegisterGarbage(conn *Connection, token string, qid uint64, delay time.Duration, ttr time.Duration) (gid uint64, err common.Error)

func SetAnswer

func SetAnswer(conn *Connection, token string, qid uint64, rc int, dr *common.DrivingRoute) (aid uint64, err common.Error)

func WithConnection

func WithConnection(addr string, do func(*Connection) common.Error) common.Error

Types

type Answer

type Answer struct {
	Timestamp    time.Time            `json:"t"`
	QuestionID   uint64               `json:"q"`
	RetryCount   int                  `json:"r"`
	DrivingRoute *common.DrivingRoute `json:"d"`
}

func AnswerFromJSON

func AnswerFromJSON(r io.Reader) (a *Answer, err common.Error)

func AnswerFromJSONBytes

func AnswerFromJSONBytes(bs []byte) (a *Answer, err common.Error)

func GetAnswer2

func GetAnswer2(conn *Connection, token string) (aid uint64, a *Answer, err common.Error)

func (Answer) ToJSON

func (a Answer) ToJSON(w io.Writer) common.Error

func (Answer) ToJSONBytes

func (a Answer) ToJSONBytes() ([]byte, common.Error)

type Connection

type Connection struct {
	Conn *beanstalk.Conn
}

type ConnectionError

type ConnectionError struct {
	common.DefaultCauser
	common.DefaultHasher
}

func NewConnectionError

func NewConnectionError(cause error, hash string) ConnectionError

func (ConnectionError) Error

func (err ConnectionError) Error() string

func (ConnectionError) ErrorDetails

func (err ConnectionError) ErrorDetails() string

type Garbage

type Garbage struct {
	Timestamp  time.Time `json:"t"`
	Token      string    `json:"x"`
	QuestionID uint64    `json:"q"`
}

func FetchGarbage

func FetchGarbage(conn *Connection) (gid uint64, g *Garbage, err common.Error)

func GarbageFromJSON

func GarbageFromJSON(r io.Reader) (g *Garbage, err common.Error)

func GarbageFromJSONBytes

func GarbageFromJSONBytes(bs []byte) (g *Garbage, err common.Error)

func (Garbage) ToJSON

func (g Garbage) ToJSON(w io.Writer) common.Error

func (Garbage) ToJSONBytes

func (g Garbage) ToJSONBytes() ([]byte, common.Error)

type JobTooBigError

type JobTooBigError struct {
	common.DefaultCauser
	common.DefaultHasher
}

func NewJobTooBigError

func NewJobTooBigError(cause error, hash string) JobTooBigError

func (JobTooBigError) Error

func (err JobTooBigError) Error() string

func (JobTooBigError) ErrorDetails

func (err JobTooBigError) ErrorDetails() string

type NotFoundError

type NotFoundError struct {
	common.DefaultCauser
	common.DefaultHasher
}

func NewNotFoundError

func NewNotFoundError(cause error, hash string) NotFoundError

func (NotFoundError) Error

func (err NotFoundError) Error() string

func (NotFoundError) ErrorDetails

func (err NotFoundError) ErrorDetails() string

type Question

type Question struct {
	Timestamp time.Time        `json:"t"`
	Token     string           `json:"x"`
	Locations common.Locations `json:"l"`
}

func FetchQuestion

func FetchQuestion(conn *Connection) (qid uint64, q *Question, err common.Error)

func GetQuestion

func GetQuestion(conn *Connection, qid uint64) (q *Question, err common.Error)

func QuestionFromJSON

func QuestionFromJSON(r io.Reader) (q *Question, err common.Error)

func QuestionFromJSONBytes

func QuestionFromJSONBytes(bs []byte) (q *Question, err common.Error)

func (Question) ToJSON

func (q Question) ToJSON(w io.Writer) common.Error

func (Question) ToJSONBytes

func (q Question) ToJSONBytes() ([]byte, common.Error)

type UnexpectedError

type UnexpectedError struct {
	common.DefaultCauser
	common.DefaultHasher
}

func NewUnexpectedError

func NewUnexpectedError(cause error, hash string) UnexpectedError

func (UnexpectedError) Error

func (err UnexpectedError) Error() string

func (UnexpectedError) ErrorDetails

func (err UnexpectedError) ErrorDetails() string

Jump to

Keyboard shortcuts

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