pub enum BandwidthClass {
Foreground,
Background,
Realtime,
}Expand description
Per-stream bandwidth class hint. Drives the v0.3 Phase D
admission gate (BandwidthBudget::try_consume_with_class) +
the anti-starvation hatch.
Foreground is the default — interactive workloads, normal
RPC responses, anything a person is waiting on.
Background is admitted only when the bucket has at least
(1 - background_fraction) × capacity available. The
anti-starvation hatch one-shot-bypasses the gate when
Background has been denied for > 60 s.
Realtime bypasses the rate-limit failure path entirely
(still subject to disk-pressure circuit-breakers). Reserved
for control-plane traffic and operator-triggered repair
sweeps.
Variants§
Foreground
Default class — interactive / user-driven work.
WARNING: v0.2-compat default — silently slips past D-phase
rate bounds. This is Default so existing v0.2 callers
migrating to v0.3 preserve their pre-D2 latency
characteristics: every replication request keeps acting like
Foreground unless the caller explicitly tags Background or
Realtime. The trade-off is that a Phase-D-aware peer that
FORGETS to override the default also gets full Foreground
rate, undermining the budget bound. Code that emits or
constructs SyncRequest / RuntimeInputs SHOULD pick a
class explicitly per workload, not rely on Default.
Background
TB-scale background work — backfills, migrations,
cold-blob warming. Bounded by background_fraction.
Realtime
Operator-pinned. Bypasses per-class rate budget.
Implementations§
Source§impl BandwidthClass
impl BandwidthClass
Sourcepub const FOREGROUND_WIRE: u8 = 0
pub const FOREGROUND_WIRE: u8 = 0
Wire-encoded discriminant. Pinned for backward compat:
new variants must take new discriminant values; never
re-purpose an existing value. Wrapping a legacy peer’s
missing-class trailing byte defaults to Foreground via
Self::from_wire_or_default.
Sourcepub const BACKGROUND_WIRE: u8 = 1
pub const BACKGROUND_WIRE: u8 = 1
Sourcepub const REALTIME_WIRE: u8 = 2
pub const REALTIME_WIRE: u8 = 2
Sourcepub fn as_u8(self) -> u8
pub fn as_u8(self) -> u8
Encode to the 1-byte wire form. The replication layer
appends this to SyncRequest
frames as a trailing byte; legacy 55-byte frames omit it
entirely and are read back via Self::from_wire_or_default.
Sourcepub fn from_wire_or_default(byte: u8) -> Self
pub fn from_wire_or_default(byte: u8) -> Self
Decode from the 1-byte wire form. Unknown discriminants
(a forward-compat scenario where a future variant lands
before this reader knows about it) decode as Foreground
— conservative degrade that keeps unknown-class requests
admitted under the most permissive gate rather than
silently dropped.
Trait Implementations§
Source§impl Clone for BandwidthClass
impl Clone for BandwidthClass
Source§fn clone(&self) -> BandwidthClass
fn clone(&self) -> BandwidthClass
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BandwidthClass
impl Debug for BandwidthClass
Source§impl Default for BandwidthClass
impl Default for BandwidthClass
Source§fn default() -> BandwidthClass
fn default() -> BandwidthClass
Source§impl Hash for BandwidthClass
impl Hash for BandwidthClass
Source§impl PartialEq for BandwidthClass
impl PartialEq for BandwidthClass
Source§fn eq(&self, other: &BandwidthClass) -> bool
fn eq(&self, other: &BandwidthClass) -> bool
self and other values to be equal, and is used by ==.impl Copy for BandwidthClass
impl Eq for BandwidthClass
impl StructuralPartialEq for BandwidthClass
Auto Trait Implementations§
impl Freeze for BandwidthClass
impl RefUnwindSafe for BandwidthClass
impl Send for BandwidthClass
impl Sync for BandwidthClass
impl Unpin for BandwidthClass
impl UnsafeUnpin for BandwidthClass
impl UnwindSafe for BandwidthClass
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
Source§impl<T> CallHasher for T
impl<T> CallHasher for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.