pub struct CapacityPolicyObservation {
pub current_capacity: usize,
pub active_approx_len: usize,
pub total_slot_capacity: usize,
pub since_last_morph: Duration,
}Expand description
A snapshot of the capacity-adaptive ring’s observable state
passed to a CapacityPolicy on every sidecar scan.
Fields§
§current_capacity: usizeCurrent capacity of the active backing (slots per sub-ring, per the underlying SPSC / MPSC / MPMC / Vyukov shape).
active_approx_len: usizeApproximate item count across every sub-ring of the active backing right now (sum over per-producer rings for composed shapes; a single ring’s depth for SPSC / Vyukov).
total_slot_capacity: usizeTotal slot inventory the producer can fill before back-
pressure. Equals current_capacity for SPSC / Vyukov;
current_capacity * n_sub_rings for composed shapes.
since_last_morph: DurationTime since the last successful capacity morph. Used by the policy to suppress thrashing via hysteresis.
Implementations§
Source§impl CapacityPolicyObservation
impl CapacityPolicyObservation
Sourcepub fn fill_ratio(&self) -> f64
pub fn fill_ratio(&self) -> f64
Convenience accessor: active_approx_len / total_slot_capacity
clamped to [0.0, 1.0]. Policy logic typically branches on
this against a grow_at upper threshold and a shrink_at
lower threshold.
Trait Implementations§
Source§impl Clone for CapacityPolicyObservation
impl Clone for CapacityPolicyObservation
Source§fn clone(&self) -> CapacityPolicyObservation
fn clone(&self) -> CapacityPolicyObservation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more