pub struct Backpressure { /* private fields */ }Expand description
Keyed backpressure over the outbox claim: resolves per-namespace ceilings and plans a round-robin, headroom-capped, fair-shared claim per sweep.
Holds only read-side state (the quota cache + this node’s shard fraction); the
claim itself goes through the unchanged OutboxStore the dispatcher already
owns. Cheap to clone (the cache shares its inner handle).
Implementations§
Source§impl Backpressure
impl Backpressure
Sourcepub fn new(quota: QuotaCache, fraction: OwnedShardFraction) -> Self
pub fn new(quota: QuotaCache, fraction: OwnedShardFraction) -> Self
Build keyed backpressure from a quota cache and this node’s owned-shard fraction.
Sourcepub async fn claim_round_robin(
&self,
store: &Arc<dyn OutboxStore>,
batch_size: u32,
held: &HashSet<WorkflowId>,
) -> Result<Vec<OutboxRow>, StoreError>
pub async fn claim_round_robin( &self, store: &Arc<dyn OutboxStore>, batch_size: u32, held: &HashSet<WorkflowId>, ) -> Result<Vec<OutboxRow>, StoreError>
Claim up to batch_size rows across all namespaces-with-pending-work, with
the batch budget allocated PER NAMESPACE first (a guaranteed fair slice each),
then distributed round-robin across each namespace’s routes. Returns every
claimed row, in claim order.
Rows not claimed (a tenant at its ceiling, or the batch budget exhausted)
stay durably Pending and are reconsidered next sweep — the keyed
backpressure: nothing is dropped, no RESOURCE_EXHAUSTED is surfaced.
§Errors
Propagates a store error from the route probe or any scoped claim; the dispatcher logs it and retries next tick (a transient backend failure must not tear the loop down).
Trait Implementations§
Source§impl Clone for Backpressure
impl Clone for Backpressure
Source§fn clone(&self) -> Backpressure
fn clone(&self) -> Backpressure
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for Backpressure
impl !UnwindSafe for Backpressure
impl Freeze for Backpressure
impl Send for Backpressure
impl Sync for Backpressure
impl Unpin for Backpressure
impl UnsafeUnpin for Backpressure
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoMaybeUndefined<T> for T
impl<T> IntoMaybeUndefined<T> for T
Source§fn into_maybe_undefined(self) -> MaybeUndefined<T>
fn into_maybe_undefined(self) -> MaybeUndefined<T>
Source§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
Source§fn into_option(self) -> Option<T>
fn into_option(self) -> Option<T>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request