pub struct QueueGuardrails { /* private fields */ }Expand description
Queue depth tracker.
Monitors the number of pending frames and produces alerts when configured thresholds are exceeded.
Implementations§
Source§impl QueueGuardrails
impl QueueGuardrails
Sourcepub fn new(config: QueueConfig) -> Self
pub fn new(config: QueueConfig) -> Self
Create a new queue guardrail with the given configuration.
Thresholds are normalized at construction (same policy as
MemoryBudgetConfig): warn_depth is clamped to max_depth and
max_depth to emergency_depth. A malformed config like
warn_depth > max_depth would otherwise produce zero-excess
DropOldest(0) / DropNewest(0) actions at the critical tier —
alerts that look actionable but do nothing (bd-1za0z).
Sourcepub fn check(
&mut self,
current_depth: u32,
) -> (Option<GuardrailAlert>, QueueAction)
pub fn check( &mut self, current_depth: u32, ) -> (Option<GuardrailAlert>, QueueAction)
Report current queue depth and get an alert if thresholds are exceeded.
Returns (alert, action) where action indicates what the runtime should
do about queued frames (if anything).
Sourcepub fn current_depth(&self) -> u32
pub fn current_depth(&self) -> u32
Current queue depth.
Sourcepub fn peak_depth(&self) -> u32
pub fn peak_depth(&self) -> u32
Peak queue depth observed.
Sourcepub fn total_drops(&self) -> u64
pub fn total_drops(&self) -> u64
Total frames dropped due to queue overflow.
Sourcepub fn total_backpressure_events(&self) -> u64
pub fn total_backpressure_events(&self) -> u64
Total backpressure events.
Sourcepub fn config(&self) -> &QueueConfig
pub fn config(&self) -> &QueueConfig
Get a reference to the configuration.
Trait Implementations§
Source§impl Clone for QueueGuardrails
impl Clone for QueueGuardrails
Source§fn clone(&self) -> QueueGuardrails
fn clone(&self) -> QueueGuardrails
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more