murder

package module
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2018 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Crow

type Crow interface {
	QueueSize(string) int                   // Query main queue size
	QueueTimeSinceCreation(string) int      // Query time since queue creation
	AddToQueue(string, interface{}, bool)   // Add object to queue
	GetQueueContents(string) []string       // Retrieve all contents of queue
	ClearQueue(string, string) error        // Clear all queue contents
	CreateLockKey(string, string, int) bool // Create lock key for a queue, confirm if lock acquired, and set TTL
	IsLocked(string) bool                   // Check if a queue is locked
	FindQueueByKey(string) (string, bool)   // Get the queue for a lock key if exists
	ExtendLockKey(string, int)              // Extend TTL of lock key to value provided
	RemoveLockKey(string)                   // Removes a lock key if exists
	MoveToReady(string, string)             // Move a queue to ready to process queues
	GetReadyQueues(string) []string         // Get full queues
}

Crow : Interface for any storage system for the orchestrator to use

type Murder

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

Murder : Orchestra for queueing systems Provides availability via introducing multiple queues, locking and clearing

func NewMurder

func NewMurder(bulkSize, TTL int, crow Crow, groupID string) *Murder

NewMurder : Returns a new instance of murder with the given options

func NewMurderWithAge

func NewMurderWithAge(bulkSize, TTL int, crow Crow, groupID string, queueAge int) *Murder

func (*Murder) Ack

func (m *Murder) Ack(lockKey string)

Ack : Acknowledge processing of a queue lock extending its time to kill Useful for long running jobs

func (*Murder) Add

func (m *Murder) Add(obj interface{})

Add : Create a job in any queue

func (*Murder) AgeConfigured

func (m *Murder) AgeConfigured() bool

func (*Murder) Get

func (m *Murder) Get(lockKey string) []string

Get : Get contents of a queue given its lock key Ensuring the worker locked the queue and acquired the lock key

func (*Murder) Lock

func (m *Murder) Lock() (string, bool)

Lock : Lock a queue returning a lock key that is needed for acknowledging the processing of the queue If no queue is ready to process, returns empty string and false

func (*Murder) Mark

func (m *Murder) Mark(lockKey string)

Mark : Mark a locked queue as done, and its jobs disposable

func (*Murder) Unlock

func (m *Murder) Unlock(lockKey string)

Unlock : Unlock a queue, but not marking it as done Useful when a worker knows it is being killed and won't be able to finish the job

type RedisCrow

type RedisCrow struct {
	Redis *redis.Client
}

func (*RedisCrow) AddToQueue

func (c *RedisCrow) AddToQueue(groupName string, obj interface{}, ageConfigured bool)

func (*RedisCrow) ClearQueue

func (c *RedisCrow) ClearQueue(queueName string, groupID string) error

func (*RedisCrow) CreateLockKey

func (c *RedisCrow) CreateLockKey(queueName string, lockKey string, TTL int) bool

func (*RedisCrow) CurrentQueue

func (c *RedisCrow) CurrentQueue(groupName string) string

func (*RedisCrow) ExtendLockKey

func (c *RedisCrow) ExtendLockKey(lockKey string, TTL int)

func (*RedisCrow) FindQueueByKey

func (c *RedisCrow) FindQueueByKey(lockKey string) (string, bool)

func (*RedisCrow) GetQueueContents

func (c *RedisCrow) GetQueueContents(queueName string) []string

func (*RedisCrow) GetReadyQueues

func (c *RedisCrow) GetReadyQueues(groupID string) []string

func (*RedisCrow) IsLocked

func (c *RedisCrow) IsLocked(queueName string) bool

func (*RedisCrow) MoveToReady

func (c *RedisCrow) MoveToReady(groupName, newName string)

func (*RedisCrow) QueueSize

func (c *RedisCrow) QueueSize(groupName string) int

func (*RedisCrow) QueueTimeSinceCreation

func (c *RedisCrow) QueueTimeSinceCreation(groupName string) int

func (*RedisCrow) RemoveLockKey

func (c *RedisCrow) RemoveLockKey(lockKey string)

Jump to

Keyboard shortcuts

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