Skip to main content

BandwidthClass

Enum BandwidthClass 

Source
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

Source

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.

Source

pub const BACKGROUND_WIRE: u8 = 1

Source

pub const REALTIME_WIRE: u8 = 2

Source

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.

Source

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

Source§

fn clone(&self) -> BandwidthClass

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for BandwidthClass

Source§

impl Debug for BandwidthClass

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BandwidthClass

Source§

fn default() -> BandwidthClass

Returns the “default value” for a type. Read more
Source§

impl Eq for BandwidthClass

Source§

impl Hash for BandwidthClass

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for BandwidthClass

Source§

fn eq(&self, other: &BandwidthClass) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for BandwidthClass

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CallHasher for T
where T: Hash + ?Sized,

Source§

default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64
where H: Hash + ?Sized, B: BuildHasher,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more