pub enum DiscardSettings {
None,
Static {
limit: usize,
mode: DiscardMode,
},
Dynamic {
limit: usize,
mode: DiscardMode,
updater: Box<dyn DynamicDiscardController>,
},
}Expand description
If a factory supports job discarding (loadshedding) it can have a few configurations which are defined in this enum. There is
- No discarding
- A static queueing limit discarding, with a specific discarding mode
- A dynamic queueing limit for discards, with a specified discarding mode and init discard limit.
Variants§
None
Don’t discard jobs
Static
A static, immutable limit
Fields
limit: usizeThe current limit. If 0, means jobs will never queue and immediately be discarded once all workers are busy
mode: DiscardModeDefine the factory messaging discard mode denoting if the oldest or newest messages should be discarded in back-pressure scenarios
Default is DiscardMode::Oldest, meaning discard jobs at the head of the queue
Dynamic
Dynamic discarding is where the discard limit can change over time, controlled
by the updater which is an implementation of the DynamicDiscardController
Fields
limit: usizeThe current limit. If 0, means jobs will never queue and immediately be discarded once all workers are busy
mode: DiscardModeDefine the factory messaging discard mode denoting if the oldest or newest messages should be discarded in back-pressure scenarios
Default is DiscardMode::Oldest, meaning discard jobs at the head of the queue
updater: Box<dyn DynamicDiscardController>The DynamicDiscardController implementation, which computes new limits dynamically based on whatever metrics it wants
Implementations§
Source§impl DiscardSettings
impl DiscardSettings
Sourcepub fn get_limit_and_mode(&self) -> Option<(usize, DiscardMode)>
pub fn get_limit_and_mode(&self) -> Option<(usize, DiscardMode)>
Retrieve the discarding limit and DiscardMode, if configured
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DiscardSettings
impl !RefUnwindSafe for DiscardSettings
impl Send for DiscardSettings
impl Sync for DiscardSettings
impl Unpin for DiscardSettings
impl !UnwindSafe for DiscardSettings
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more