queue

package
v0.0.0-...-32f009b Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoltQueueStorage

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

func NewStorage

func NewStorage(db storm.Node) *BoltQueueStorage

func (*BoltQueueStorage) DeleteJob

func (s *BoltQueueStorage) DeleteJob(j Job) error

func (*BoltQueueStorage) Map

func (s *BoltQueueStorage) Map(queue chan Job)

map over all jobs and send them into the given

func (*BoltQueueStorage) PersistJob

func (s *BoltQueueStorage) PersistJob(j *Job) error

type Job

type Job struct {
	ID   int `storm:"id,increment"`
	Type string
	Data map[string]interface{}
}

type Processor

type Processor interface {
	Type() string
	ValidJob(j Job) error
	Process(j Job) error
}

type Queue

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

func New

func New(s Storage, jobStackSize uint, concurrency uint) *Queue

func (*Queue) AddJob

func (q *Queue) AddJob(j Job) error

persist job to queue

func (*Queue) Close

func (q *Queue) Close() error

close the queue

func (*Queue) DeleteJob

func (q *Queue) DeleteJob(j Job) error

func (*Queue) RegisterProcessor

func (q *Queue) RegisterProcessor(p Processor) error

register a new processor

type Storage

type Storage interface {
	PersistJob(j *Job) error
	DeleteJob(j Job) error
	Map(queue chan Job)
}

Jump to

Keyboard shortcuts

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