#[non_exhaustive]pub enum ShapeOutcome {
Dropped,
Expired,
Policed,
StreamReset {
code: u64,
},
}Expand description
What ProxyEvent::Shaped reports the shaper did.
#[non_exhaustive]; derives PartialEq/Eq like Effect and
ImpairmentKind, so a test destructures the event and compares this.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Dropped
A unit was discarded by
Overflow::DropTail.
The unit went through the framer’s elide path, so absolute object IDs on drafts 14-19 stay correct; a unit an elide guard refused was admitted instead of dropped and is reported as a refusal, not here.
Expired
A queued unit outlived max_hold under
Expiry::ResetStream.
Decided at release time rather than at admission: the queue notices
the overrun when it next looks at its head, replaces everything it
was holding with the reset the policy asked for, and reports this.
So the event says the whole destination stream was abandoned, not
that one unit was — which is why it carries an empty class for the
same reason Self::StreamReset does.
Emitted once per stream. The queue is gone after the first one, so there is nothing left to expire.
This variant read “no producer yet” for as long as expiry was decided
nowhere; it now has one, and asserting on it is
actions_shaping.rs’s business rather than a promise waiting to be
kept.
Policed
A datagram was discarded because its class’s bucket had no tokens for it.
Policing rather than shaping, and the difference is that there is no queue: a datagram arriving over its class’s configured rate is dropped at admission rather than held until the tokens arrive. That is the only sound answer for this carrier — a queue would impose an order the protocol does not have, and a datagram has no successor whose framing depends on it, which is what makes discarding one harmless where discarding a queued stream unit is not.
Carried only by ProxyEvent::ShapedDatagram. Self::Dropped is
the stream carrier’s answer and says something different: that an
overflow policy discarded a unit the queue had no room for.
StreamReset
The destination stream was abandoned by an overflow or expiry policy.
Trait Implementations§
Source§impl Clone for ShapeOutcome
impl Clone for ShapeOutcome
Source§fn clone(&self) -> ShapeOutcome
fn clone(&self) -> ShapeOutcome
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more