mqs

package
v0.0.0-...-d59d7d1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2018 License: Apache-2.0 Imports: 21 Imported by: 11

Documentation

Index

Constants

View Source
const NumPriorities = 3

Variables

This section is empty.

Functions

func New

func New(mqURL string) (models.MessageQueue, error)

New will parse the URL and return the correct MQ implementation.

Types

type BoltDbConfig

type BoltDbConfig struct {
	FileName string `mapstructure:"filename"`
}

type BoltDbMQ

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

func NewBoltMQ

func NewBoltMQ(url *url.URL) (*BoltDbMQ, error)

func (*BoltDbMQ) Delete

func (mq *BoltDbMQ) Delete(ctx context.Context, job *models.Task) error

func (*BoltDbMQ) Push

func (mq *BoltDbMQ) Push(ctx context.Context, job *models.Task) (*models.Task, error)

func (*BoltDbMQ) Reserve

func (mq *BoltDbMQ) Reserve(ctx context.Context) (*models.Task, error)

func (*BoltDbMQ) Start

func (mq *BoltDbMQ) Start()

type IronMQ

type IronMQ struct {

	// Protects the map
	sync.Mutex
	// contains filtered or unexported fields
}

func NewIronMQ

func NewIronMQ(url *url.URL) *IronMQ

func (*IronMQ) Delete

func (mq *IronMQ) Delete(ctx context.Context, job *models.Task) error

func (*IronMQ) Push

func (mq *IronMQ) Push(ctx context.Context, job *models.Task) (*models.Task, error)

func (*IronMQ) Reserve

func (mq *IronMQ) Reserve(ctx context.Context) (*models.Task, error)

type IronMQConfig

type IronMQConfig struct {
	Token       string `mapstructure:"token"`
	ProjectId   string `mapstructure:"project_id"`
	Host        string `mapstructure:"host"`
	Scheme      string `mapstructure:"scheme"`
	Port        uint16 `mapstructure:"port"`
	QueuePrefix string `mapstructure:"queue_prefix"`
}

type MemoryMQ

type MemoryMQ struct {
	// WorkQueue A buffered channel that we can send work requests on.
	PriorityQueues []chan *models.Task
	Ticker         *time.Ticker
	BTree          *btree.BTree
	Timeouts       map[string]*TaskItem
	// Protects B-tree and Timeouts
	// If this becomes a bottleneck, consider separating the two mutexes. The
	// goroutine to clear up timed out messages could also become a bottleneck at
	// some point. May need to switch to bucketing of some sort.
	Mutex sync.Mutex
}

func NewMemoryMQ

func NewMemoryMQ() *MemoryMQ

func (*MemoryMQ) Delete

func (mq *MemoryMQ) Delete(ctx context.Context, job *models.Task) error

func (*MemoryMQ) Push

func (mq *MemoryMQ) Push(ctx context.Context, job *models.Task) (*models.Task, error)

func (*MemoryMQ) Reserve

func (mq *MemoryMQ) Reserve(ctx context.Context) (*models.Task, error)

type Mock

type Mock struct {
	FakeApp   *models.App
	Apps      []*models.App
	FakeRoute *models.Route
	Routes    []*models.Route
}

func (*Mock) Delete

func (mock *Mock) Delete(context.Context, *models.Task) error

func (*Mock) Push

func (mock *Mock) Push(context.Context, *models.Task) (*models.Task, error)

func (*Mock) Reserve

func (mock *Mock) Reserve(context.Context) (*models.Task, error)

type RedisMQ

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

func NewRedisMQ

func NewRedisMQ(url *url.URL) (*RedisMQ, error)

func (*RedisMQ) Delete

func (mq *RedisMQ) Delete(ctx context.Context, job *models.Task) error

func (*RedisMQ) Push

func (mq *RedisMQ) Push(ctx context.Context, job *models.Task) (*models.Task, error)

func (*RedisMQ) Reserve

func (mq *RedisMQ) Reserve(ctx context.Context) (*models.Task, error)

Would be nice to switch to this model http://redis.io/commands/rpoplpush#pattern-reliable-queue

type TaskItem

type TaskItem struct {
	Task    *models.Task
	StartAt time.Time
}

TaskItem is for the Btree, implements btree.Item

func (*TaskItem) Less

func (ji *TaskItem) Less(than btree.Item) bool

Jump to

Keyboard shortcuts

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