#[non_exhaustive]pub struct DecodeLimits {
pub max_decoded_bytes: u64,
/* private fields */
}Expand description
Resource limits for decode_entries_with.
A pack’s wire size says little about what decoding it allocates: a
0x03/0x04 entry may claim up to MAX_RAW_OBJECT_SIZE bytes from a
few-byte zstd frame, a delta may declare a result of the same size
from a short run of copies, and a tiny delta may name a huge external
base. A decoder that held all of that until the pack ends would let a
sub-kilobyte pack pin gigabytes. decode_entries_with therefore
charges every such allocation against Self::max_decoded_bytes and
rejects the pack with PackError::PackfileTooLarge once the total
passes it.
The budget is per call. It bounds one decode, not a process: a
server running several decodes at once (WP-4.7) must size it from its
isolate’s memory limit divided by its decode concurrency. The default,
Self::DEFAULT_MAX_DECODED_BYTES (1 GiB), equals the largest object
the format allows (MAX_RAW_OBJECT_SIZE) so that any single valid
object decodes; it is not sized for a constrained isolate.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.max_decoded_bytes: u64Cap on the bytes one decode may hold beyond the pack itself: every
0x03/0x04 entry’s claimed uncompressed_len, every delta’s
declared result length, and every external base fetched from the
DeltaBaseSource while it is cached. 0x00 payloads are borrowed
from the pack and do not count. An external base is measured once
fetched, so the peak can pass the cap by the one base whose fetch
trips it.
Implementations§
Source§impl DecodeLimits
impl DecodeLimits
Sourcepub const DEFAULT_MAX_DECODED_BYTES: u64
pub const DEFAULT_MAX_DECODED_BYTES: u64
Default Self::max_decoded_bytes: 1 GiB, the maximum object size
(MAX_RAW_OBJECT_SIZE). Servers set their own (see the type docs).
Sourcepub const fn with_max_decoded_bytes(self, bytes: u64) -> Self
pub const fn with_max_decoded_bytes(self, bytes: u64) -> Self
These limits with Self::max_decoded_bytes set to bytes.
Sourcepub const fn with_entry_geometry(self, frame: u64, delta_stream: u64) -> Self
pub const fn with_entry_geometry(self, frame: u64, delta_stream: u64) -> Self
Bound encoded payloads and delta streams separately from canonical bytes.
Trait Implementations§
Source§impl Clone for DecodeLimits
impl Clone for DecodeLimits
impl Copy for DecodeLimits
Source§impl Debug for DecodeLimits
impl Debug for DecodeLimits
Source§impl Default for DecodeLimits
impl Default for DecodeLimits
impl Eq for DecodeLimits
Source§impl PartialEq for DecodeLimits
impl PartialEq for DecodeLimits
impl StructuralPartialEq for DecodeLimits
Auto Trait Implementations§
impl Freeze for DecodeLimits
impl RefUnwindSafe for DecodeLimits
impl Send for DecodeLimits
impl Sync for DecodeLimits
impl Unpin for DecodeLimits
impl UnsafeUnpin for DecodeLimits
impl UnwindSafe for DecodeLimits
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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 more