claimablejob

package module
v0.0.0-...-9c6f1ae Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2015 License: MIT Imports: 4 Imported by: 1

README

redisjob

A redis job

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClaimableJob

type ClaimableJob interface {
	Claim() (bool, error)
	GetKey() string
	PushKeyIntoQueue(name string) error
}

ClaimableJob represents a job in the queue that can know if it should have action taken upon it

type ClaimableRedisJob

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

ClaimableRedisJob implements ClaimableJob and stores/retrieves jobs from Redis

func New

func New(key string, conn Conn) *ClaimableRedisJob

New returns a new job

func NewFromJob

func NewFromJob(job Job, conn Conn) *ClaimableRedisJob

NewFromJob returns a new job based on a Job

func (*ClaimableRedisJob) Claim

func (job *ClaimableRedisJob) Claim() (bool, error)

Claim returns true when the caller succesfully claims the job

func (*ClaimableRedisJob) GetKey

func (job *ClaimableRedisJob) GetKey() string

GetKey returns the key to store the information about the job

func (*ClaimableRedisJob) PushKeyIntoQueue

func (job *ClaimableRedisJob) PushKeyIntoQueue(queueName string) error

PushKeyIntoQueue pushes a key into a queue

type Conn

type Conn interface {
	Do(commandName string, args ...interface{}) (interface{}, error)
}

Conn is what all claimable jobs require

type Job

type Job interface {
	GetKey() string
}

Job represents a job in the queue

Jump to

Keyboard shortcuts

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