Skip to main content

ShapeError

Enum ShapeError 

Source
#[non_exhaustive]
pub enum ShapeError { DuplicateClassName { name: String, }, UnknownBucket { class: String, bucket: String, }, EgressSideInMatcher { class: String, }, ZeroWeight { class: String, }, EmptyQueue, NoClasses, InertMatcher { class: String, key: &'static str, }, }
Expand description

Why a ShapeProfile could not be built.

#[non_exhaustive] and no Default: nobody constructs an error, and a later release adding a further reason must not be a breaking change.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

DuplicateClassName

Two classes share a name. Class names index the stats, so they must be unique or the stats are unattributable.

Fields

§name: String

The name that appeared more than once.

§

UnknownBucket

A class names a bucket that is not in buckets.

Fields

§class: String

The class holding the dangling reference.

§bucket: String

The bucket name that matches no BucketConfig.

§

EgressSideInMatcher

A matcher’s side is an egress label. Hook sites only ever see ClientToProxy / RelayToProxy, so such a rule matches nothing — rejected here rather than left to look like a working rule that never fires.

Fields

§class: String

The class whose matcher named an egress side.

§

ZeroWeight

Discipline::WeightedRoundRobin with a zero weight: a class that can never be scheduled.

Fields

§class: String

The class whose weight is zero.

§

EmptyQueue

QueueConfig::depth_objects or QueueConfig::depth_bytes is zero, so the queue could admit nothing.

§

NoClasses

The profile declares no class rules, so it is a shaping profile that shapes nothing.

Every unit such a profile sees falls to Class::Default, which is unpaced: no bucket claims it, no discipline arbitrates it and the queue releases it as soon as it reaches the head. A session configured with one therefore frames every object — because a profile arms framing on its own — pays for the classification and the queue, reports itself as shaping, and delivers at line rate. Nothing in crate::shape::ShapeStats distinguishes it from a profile whose classes never matched.

§It also used to reach further than the session that carried it

A proxy sizes its class rows once, from the first shaped session it accepts, because a class is an index into the class list of the scheduler that produced it and rows that could be resized underneath a running session would relabel every figure in them. A classless profile arriving first would have installed no rows at all, and every classed session accepted afterwards — for the life of the proxy — would have found rows it did not match and charged the default one: every number right, every label gone, unrecoverable without a restart. That is guarded a second time where the sizing happens, but the guard is a repair at the far end of the pipe; this is the profile never existing.

A caller who wants the queue policy and no pacing writes one class claiming everything, over a bucket with no rate — an explicitly unshaped class, which has a name and a row of its own and says in the configuration what a missing class list only implied.

§

InertMatcher

A Matcher key names an empty set of values, so the class can never claim a unit — on any draft, from any traffic.

The three shapes this catches, all of which were accepted before: a RangeSet built from an inverted range (RangeSet::new drops start > end, leaving an empty set whose contains is always false), an empty Matcher::priority range such as 200..=100, and Matcher::every_nth with n == 0.

Distinct from ImpairmentKind::ShapeRuleUnmatchable, and the distinction is when the answer exists: a rule keyed on a field this draft does not carry can only be judged against a running session, so it is reported; an empty value set is a property of the configuration by itself, so it is rejected before a session starts. Rejecting is strictly the better answer where it is available — there is no run to read the report from.

Fields

§class: String

The class whose matcher can never claim anything.

§key: &'static str

The key that names the empty set, spelled as the Matcher field is: one of track_alias, group_id, subgroup_id, object_id, priority, every_nth.

Trait Implementations§

Source§

impl Clone for ShapeError

Source§

fn clone(&self) -> ShapeError

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 Debug for ShapeError

Source§

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

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

impl Display for ShapeError

Source§

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

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

impl Eq for ShapeError

Source§

impl Error for ShapeError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<ShapeError> for ControlError

Source§

fn from(source: ShapeError) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for ShapeError

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ShapeError

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> 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<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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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