Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrQueueIsFull is the error returned when an item is offered to the Queue and the queue is full. ErrQueueIsFull = errors.New("sending queue is full") // ErrQueueIsStopped is the error returned when an item is offered to the Queue and the queue is stopped. ErrQueueIsStopped = errors.New("sending queue is stopped") )
Functions ¶
func NewMockStorageExtension ¶ added in v0.84.0
Types ¶
type Queue ¶ added in v0.89.0
type Queue[T any] interface { component.Component // Offer inserts the specified element into this queue if it is possible to do so immediately // without violating capacity restrictions. If success returns no error. // It returns ErrQueueIsFull if no space is currently available. Offer(ctx context.Context, item T) error // Consume applies the provided function on the head of queue. // The call blocks until there is an item available or the queue is stopped. // The function returns true when an item is consumed or false if the queue is stopped. Consume(func(ctx context.Context, item T)) bool // Size returns the current Size of the queue Size() int // Capacity returns the capacity of the queue. Capacity() int }
Queue defines a producer-consumer exchange which can be backed by e.g. the memory-based ring buffer queue (boundedMemoryQueue) or via a disk-based queue (persistentQueue)
func NewBoundedMemoryQueue ¶
NewBoundedMemoryQueue constructs the new queue of specified capacity, and with an optional callback for dropped items (e.g. useful to emit metrics).
func NewPersistentQueue ¶
func NewPersistentQueue[T any](capacity int, dataType component.DataType, storageID component.ID, marshaler func(req T) ([]byte, error), unmarshaler func([]byte) (T, error), set exporter.CreateSettings) Queue[T]
NewPersistentQueue creates a new queue backed by file storage; name and signal must be a unique combination that identifies the queue storage
type QueueConsumers ¶ added in v0.90.0
type QueueConsumers[T any] struct { // contains filtered or unexported fields }
func NewQueueConsumers ¶ added in v0.90.0
Click to show internal directories.
Click to hide internal directories.