pub struct DeadLetterQueue { /* private fields */ }Expand description
In-memory dead-letter queue for shed pipeline requests.
Stores up to capacity most-recent dropped requests in a ring buffer.
When full, the oldest entry is evicted to make room for the newest.
Thread-safe via an internal Mutex. Clone is cheap — all clones share
the same underlying ring.
Implementations§
Source§impl DeadLetterQueue
impl DeadLetterQueue
Sourcepub fn new(capacity: usize) -> Self
pub fn new(capacity: usize) -> Self
Create a new DeadLetterQueue with the given ring-buffer capacity.
§Panics
This function does not panic.
Sourcepub fn push(&self, req: DroppedRequest)
pub fn push(&self, req: DroppedRequest)
Push a dropped request into the queue. Evicts the oldest entry if full.
§Panics
This function does not panic. If the internal mutex is poisoned it is recovered automatically and a warning is logged.
Sourcepub fn drain(&self) -> Vec<DroppedRequest>
pub fn drain(&self) -> Vec<DroppedRequest>
Drain all queued entries and return them, clearing the queue.
§Panics
This function does not panic. If the internal mutex is poisoned it is recovered automatically and a warning is logged.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Return the number of entries currently in the queue.
§Panics
This function does not panic. If the internal mutex is poisoned it is recovered automatically and a warning is logged.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Return true if the queue contains no entries.
§Panics
This function does not panic. If the internal mutex is poisoned it is recovered automatically and a warning is logged.
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Return the maximum number of entries this queue can hold before evicting.
§Panics
This function does not panic.
Sourcepub fn peek(&self) -> Vec<DroppedRequest>
pub fn peek(&self) -> Vec<DroppedRequest>
Return a snapshot of all queued entries without removing them.
Unlike drain, this does not clear the queue. The
snapshot is a clone taken under the lock; the queue continues to
operate normally while the returned Vec is used.
§Panics
This function does not panic. If the internal mutex is poisoned it is recovered automatically and a warning is logged.
Trait Implementations§
Source§impl Clone for DeadLetterQueue
impl Clone for DeadLetterQueue
Source§fn clone(&self) -> DeadLetterQueue
fn clone(&self) -> DeadLetterQueue
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for DeadLetterQueue
impl RefUnwindSafe for DeadLetterQueue
impl Send for DeadLetterQueue
impl Sync for DeadLetterQueue
impl Unpin for DeadLetterQueue
impl UnsafeUnpin for DeadLetterQueue
impl UnwindSafe for DeadLetterQueue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request