queue

package
v0.0.0-...-e825d84 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2019 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateJob

func CreateJob(pool *redis.Pool, name string, job []byte) (bool, error)

CreateJob creates a new job for the queue

func EmptyQueue

func EmptyQueue(pool *redis.Pool, name string) (bool, error)

EmptyQueue empty the queue of jobs

func NewPool

func NewPool() *redis.Pool

NewPool Creates a new REDIS Pool

func NewQueue

func NewQueue(pool *redis.Pool, name string) (bool, error)

NewQueue creates a new job queue

func RunJobWithHandler

func RunJobWithHandler(pool *redis.Pool, name string, handler func([]byte) ([]byte, error)) ([]byte, error)

RunJobWithHandler runs the next job of a queue

func WaitAndRunJob

func WaitAndRunJob(pool *redis.Pool, name string, job []byte) (bool, error)

WaitAndRunJob runs the next job of a queue

Types

type Queue

type Queue struct {
	Name   string   `json:"name"`
	Offset int      `json:"offset"`
	Jobs   [][]byte `json:"jobs"`
}

Queue represents a proxy queue for requests

func GetQueue

func GetQueue(pool *redis.Pool, name string) (*Queue, error)

GetQueue gets the status of a queue

type SimpleJob

type SimpleJob struct {
	Command string `json:"command"`
	Arg1    int    `json:"arg1"`
	Arg2    int    `json:"arg2"`
}

SimpleJob serialization

Jump to

Keyboard shortcuts

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