Documentation ¶
Overview ¶
Package q provides interfaces and types for use in a FIFO queue system.
Index ¶
Constants ¶
const Unbounded int = -1
Unbounded queues will accept messages until they exhaust available resources.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager interface { Add(Queue) error // Add a new queue to the manager. Get(id uuid.UUID) (Queue, error) // Get an existing queue given its ID. Delete(id uuid.UUID) error // Delete an existing queue given its ID. List() ([]Queue, error) // List all existing queues. }
A Manager manages a set of queues.
type Message ¶
type Message struct { *Metadata Payload []byte // The Payload of a Message is an arbitrary byte array. }
A Message represents an entry in a queue.
func NewMessage ¶
NewMessage creates a message from the supplied payload.
type Metadata ¶
type Metadata struct { ID uuid.UUID // ID is a globally unique identifier for a resource. Created time.Time // Created is the creation time of a resource. Tags *Tags // Tags are arbitrary key:value pairs associated with a resource. }
Metadata is useful information associated with either queues or messages.
type Metrics ¶
type Metrics interface { Enqueued(id uuid.UUID) // Enqueued increments the enqueued message count. Consumed(id uuid.UUID) // Consumed increments the consumed message count. // Error increments the count of errors encountered while queueing or consuming messages. Error(id uuid.UUID, t Error) }
Metrics for a queue. We only expose counts, not gauges, because they don't lose meaning when downsampled in a timeseries. See https://goo.gl/WTHgAq for details.
type Option ¶
type Option func(*Message)
An Option represents an optional argument to a new message.
type Queue ¶
type Queue interface { ID() uuid.UUID // ID is the globally unique identifier for this queue. Created() time.Time // Created is the creation time of this queue. Tags() *Tags // Tags are arbitrary key:value pairs associated with this queue. Store() Store // Store indicates which backing store this queue uses. Add(*Message) error // Add amends a message to this queue. Pop() (*Message, error) // Pop consumes and returns the next message in the queue. Peek() (*Message, error) // Peek returns the next message in the queue without consuming it. }
A Queue stores Messages for consumption by another process.
type Tags ¶
type Tags struct {
// contains filtered or unexported fields
}
Tags are a threadsafe set of tags. A single key may have multiple values.
func (*Tags) Contains ¶
Contains indicates whether the given key value pair exists in a set of tags.
func (*Tags) ContainsTag ¶
ContainsTag indicates whether the given tag exists in a set of tags.
Directories ¶
Path | Synopsis |
---|---|
Package bdb provides a FIFO queue backed by a BoltDB database.
|
Package bdb provides a FIFO queue backed by a BoltDB database. |
cmd
|
|
Package e provides error types and handling.
|
Package e provides error types and handling. |
Package factory provides a FIFO queue factory.
|
Package factory provides a FIFO queue factory. |
Package logging provides logging wrappers for queues and queue managers.
|
Package logging provides logging wrappers for queues and queue managers. |
Package manager provides implementations of queue managers, which act as an index of various FIFO queues.
|
Package manager provides implementations of queue managers, which act as an index of various FIFO queues. |
Package memory provides an in-memory FIFO queue backed by a linked list.
|
Package memory provides an in-memory FIFO queue backed by a linked list. |
Package metrics provides implementations of the q.Metrics interface and a wrapper to expose metrics for any implementation of the q.Queue interface.
|
Package metrics provides implementations of the q.Metrics interface and a wrapper to expose metrics for any implementation of the q.Queue interface. |
Package proto is a generated protocol buffer package.
|
Package proto is a generated protocol buffer package. |
Package rpc implements a gRPC server for the q queue service.
|
Package rpc implements a gRPC server for the q queue service. |
test
|
|
integration
Package integration is an integration test.
|
Package integration is an integration test. |