queue

package module
v0.0.0-...-e97de6a Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2014 License: Apache-2.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

simple-queue

Silly, simple local queue written in go. Inspired by beanstalkd using sqlite

Written as an experiment.

May be useful for extremely simple use case of needing a simple persisted job list.

Documentation

Index

Constants

View Source
const (
	STATE_UNKNOWN = iota
	STATE_READY
	STATE_RESERVED
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job struct {
	ID       int
	Tube     string
	Created  time.Time
	Modified time.Time
	State    int
	Priority uint
	Data     []byte
	TTR      time.Duration
	// contains filtered or unexported fields
}

func (*Job) Delete

func (j *Job) Delete() error

Delete removes a job

func (*Job) Touch

func (j *Job) Touch(ttr int) error

type Queue

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

func New

func New(filename string, buffer int, maintanence int) (*Queue, error)

func (*Queue) Close

func (q *Queue) Close() error

Close closes the underlying database handle and stops maintainence routines

func (*Queue) Jobs

func (q *Queue) Jobs(tube string) ([]*Job, error)

Jobs returns all Jobs in a tube

func (*Queue) Maintanence

func (q *Queue) Maintanence() error

func (*Queue) Put

func (q *Queue) Put(tube string, priority int, ttr int, data []byte) error

func (*Queue) Reserve

func (q *Queue) Reserve(tube string, timeout int) (*Job, error)

func (*Queue) Tube

func (q *Queue) Tube(tube string) (*Tube, error)

type Tube

type Tube struct {
	Name string
	// contains filtered or unexported fields
}

func (*Tube) Put

func (t *Tube) Put(priority int, ttr int, data []byte) error

func (*Tube) Reserve

func (t *Tube) Reserve(timeout int) (*Job, error)

Jump to

Keyboard shortcuts

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