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