pub enum BackpressurePolicy {
Drop,
SpinThenBlock,
Block,
}Expand description
Backpressure policy to apply when routing to consumers.
§Contract
- Backpressure policies only affect the router loop (this crate). Producers and consumers are still nonblocking and may observe drops depending on mode and policy.
- In v1, only [
RouterMode::WorkQueue] can apply backpressure without changing the ABI layout. [RouterMode::Broadcast] remains best-effort and uses drop-on-full semantics.
§Notes
BackpressurePolicy::SpinThenBlockis a CPU-side wait strategy; it does not use wake sections.BackpressurePolicy::Blockuses optional v1 wake sections when available; if wake-backed waits fail at runtime, the loop falls back to the provided [WaitStrategy].
Variants§
Drop
Drop when a destination queue is full.
SpinThenBlock
When routing in RouterMode::WorkQueue, avoid dequeuing a message if all consumer queues
are full; instead, apply the configured wait strategy until at least one consumer has
capacity.
Notes:
- This is a v1 best-effort policy; it does not use wake sections.
- In
RouterMode::Broadcast, this policy behaves likeDrop(broadcast cannot be made “all-or-nothing” without a different layout).
Block
Use the optional v1 wake sections (INDEXBUS_CAP_SUPPORTS_BLOCKING) to block the router
thread when idle or when all consumers are full.
Notes:
- Implemented only for
RouterMode::WorkQueue. - If wake sections are unavailable, this falls back to the configured wait strategy.
Trait Implementations§
Source§impl Clone for BackpressurePolicy
impl Clone for BackpressurePolicy
Source§fn clone(&self) -> BackpressurePolicy
fn clone(&self) -> BackpressurePolicy
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BackpressurePolicy
impl Debug for BackpressurePolicy
Source§impl PartialEq for BackpressurePolicy
impl PartialEq for BackpressurePolicy
impl Copy for BackpressurePolicy
impl Eq for BackpressurePolicy
impl StructuralPartialEq for BackpressurePolicy
Auto Trait Implementations§
impl Freeze for BackpressurePolicy
impl RefUnwindSafe for BackpressurePolicy
impl Send for BackpressurePolicy
impl Sync for BackpressurePolicy
impl Unpin for BackpressurePolicy
impl UnwindSafe for BackpressurePolicy
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
Mutably borrows from an owned value. Read more