Crate elasticq

Crate elasticq 

Source
Expand description

A thread-safe, dynamically resizable circular buffer implementation.

This buffer is designed for high-throughput scenarios, particularly suitable for use in MQTT proxy applications where efficient message buffering is critical.

§Features

  • Default: Lock-based circular buffer with dynamic resizing
  • async: Async/await support with Tokio
  • lock_free: Lock-free MPSC queue for high-throughput scenarios
  • priority: Priority queue with configurable levels (great for MQTT QoS)
  • streams: Async Stream and Sink integration
  • persistent: Durable buffer with crash recovery
  • metrics: Prometheus-compatible metrics and observability

§Example

use elasticq::{DynamicCircularBuffer, Config};

let buffer = DynamicCircularBuffer::<i32>::new(Config::default()).unwrap();
buffer.push(42).unwrap();
assert_eq!(buffer.pop().unwrap(), 42);

Structs§

Config
DynamicCircularBuffer
The main struct representing the dynamic circular buffer.

Enums§

BufferError

Type Aliases§

BufferResult
ThreadSafeDynamicCircularBuffer
A thread-safe wrapper around DynamicCircularBuffer.