pub struct ReassemblyLimits {
pub max_pending_messages: usize,
pub max_chunk_data_len: usize,
pub max_message_bytes: usize,
pub max_chunks_per_message: usize,
pub max_total_buffered_cost: usize,
pub slot_overhead: usize,
pub max_completed_ids: usize,
}Expand description
The limits a super::MessageReassembler enforces on incoming chunks, as an explicit value
rather than module globals. This keeps the core admission rule independent of where the
numbers come from: the shell supplies them (see ReassemblyLimits::production), the
reassembler only enforces what it is given, and tests can use small limits instead of giant
synthetic payloads.
Fields§
§max_pending_messages: usizeMax number of distinct in-flight message ids (a cheap first-line cap; the byte budgets are the real memory guard).
max_chunk_data_len: usizeMax data bytes a single chunk may carry.
max_message_bytes: usizeMax buffered data bytes for one in-flight message.
max_chunks_per_message: usizeMax number of slots (chunks) one in-flight message may have - i.e. the largest total a
chunk may claim. Caps the slot/BTreeMap count of a single message so a hostile peer cannot
use one id with a huge total and tiny chunks to allocate millions of slots while staying
under max_message_bytes (which only counts data bytes).
max_total_buffered_cost: usizeMax buffered cost (data bytes + per-slot overhead) summed across all in-flight messages.
slot_overhead: usizeBookkeeping charge per slot - a conservative estimate (not an exact measurement) of the
BTreeMap node plus Bytes header/refcount a slot costs, so a flood of tiny chunks is
bounded by slot count, not only by summed data bytes. Real per-slot heap use may differ;
this is deliberately generous so the budget over- rather than under-counts.
max_completed_ids: usizeMax number of recently-completed message ids remembered as tombstones, to suppress a
re-delivery if a message is fully retransmitted after it already completed (within its TTL
window). The same number separately caps invalid-terminal ids and ids rejected before local
capacity could retain state. Invalid ids fail open without peer attribution when their set
is full, with a bounded saturation horizon preserving that decision while tombstones drain;
capacity-history saturation temporarily rejects all new ids for that peer. Thus
terminal bookkeeping retains at most three times this many ids across the independent
completed, invalid, and capacity sets, plus two scalar saturation horizons. NOTE: past
this many concurrent live completion
tombstones the oldest is dropped even if its TTL has not elapsed, so the “no
post-completion redelivery” guarantee holds only for the most recent max_completed_ids
completions within a TTL window.
Implementations§
Source§impl ReassemblyLimits
impl ReassemblyLimits
Sourcepub fn production() -> ReassemblyLimits
pub fn production() -> ReassemblyLimits
The limits used in production, derived from the transport / message ceilings. This is the one place that reaches for transport-specific constants; the reassembler itself does not.
Sourcepub fn constrained() -> ReassemblyLimits
pub fn constrained() -> ReassemblyLimits
Lower-concurrency limits for constrained deployments.
The per-message ceiling remains protocol-compatible with production. Constrained nodes instead admit fewer simultaneous messages and only one maximum-size reassembly, including its contiguous output copy.
Trait Implementations§
Source§impl Clone for ReassemblyLimits
impl Clone for ReassemblyLimits
Source§fn clone(&self) -> ReassemblyLimits
fn clone(&self) -> ReassemblyLimits
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ReassemblyLimits
Source§impl Debug for ReassemblyLimits
impl Debug for ReassemblyLimits
Source§impl Default for ReassemblyLimits
impl Default for ReassemblyLimits
Source§fn default() -> ReassemblyLimits
fn default() -> ReassemblyLimits
Auto Trait Implementations§
impl Freeze for ReassemblyLimits
impl RefUnwindSafe for ReassemblyLimits
impl Send for ReassemblyLimits
impl Sync for ReassemblyLimits
impl Unpin for ReassemblyLimits
impl UnsafeUnpin for ReassemblyLimits
impl UnwindSafe for ReassemblyLimits
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T> MaybeSend for T
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.