pub struct QueryLimits {
pub codec: CodecLimits,
pub structural: StructuralLimits,
pub remote_request_bytes: usize,
}Expand description
The complete set of ceilings applied to one query session’s plans.
Every query-path limit is a field here; nothing on that path reads a
constant. Self::CANONICAL reproduces the released fixed ceilings. A
value from a session, an advertisement, or an embedding host is untrusted
until Self::validate accepts it.
Fields§
§codec: CodecLimitsCanonical JSON ceilings for one plan or invocation artifact.
structural: StructuralLimitsTyped-plan structural ceilings.
remote_request_bytes: usizeMaximum bytes in one remote request envelope.
Reply size is not a query limit: it belongs to the caller’s answer budget and the executor’s answer ceilings.
Implementations§
Source§impl QueryLimits
impl QueryLimits
Sourcepub fn set(&mut self, name: &str, value: usize) -> bool
pub fn set(&mut self, name: &str, value: usize) -> bool
Replace the limit with this stable name.
Returns false and changes nothing for an unknown name. The
result is unvalidated until Self::validate accepts it.
Sourcepub fn supported_maximum(name: &str) -> Option<usize>
pub fn supported_maximum(name: &str) -> Option<usize>
Return the largest value the implementation supports for the limit with this stable name.
Source§impl QueryLimits
impl QueryLimits
Sourcepub const CANONICAL: QueryLimits
pub const CANONICAL: QueryLimits
The released fixed ceilings.
Sourcepub fn validate(self) -> Result<QueryLimits, QueryLimitsError>
pub fn validate(self) -> Result<QueryLimits, QueryLimitsError>
Admit one untrusted limits value.
Every limit must be at least one and no larger than the implementation supports. Bounds the implementation does not have are not invented here: byte and count ceilings are otherwise free.
Sourcepub fn from_overrides<'name>(
overrides: impl IntoIterator<Item = (&'name str, u64)>,
) -> Result<QueryLimits, QueryLimitsError>
pub fn from_overrides<'name>( overrides: impl IntoIterator<Item = (&'name str, u64)>, ) -> Result<QueryLimits, QueryLimitsError>
Build validated limits from named overrides of the canonical defaults.
This is the one entry point for limits that arrive as untrusted name/value pairs: a host configuration, a language binding, or a server file. A limit that is not named keeps its default.
Sourcepub fn min(self, other: QueryLimits) -> QueryLimits
pub fn min(self, other: QueryLimits) -> QueryLimits
Return the stricter of two limits, field by field.
Sourcepub const fn remote_request_codec(self) -> CodecLimits
pub const fn remote_request_codec(self) -> CodecLimits
Codec limits for one remote request envelope.
A request embeds an independently canonical plan beneath exactly one framing object, hence the extra level.
Sourcepub const fn invocation_bytes(self) -> usize
pub const fn invocation_bytes(self) -> usize
Maximum canonical bytes in one complete plan-bound invocation.
The owning wire object adds 234 fixed bytes around the input-row
batch; see MAX_QUERY_INVOCATION_BYTES.
Source§impl QueryLimits
impl QueryLimits
Sourcepub fn source_of(&self, name: &str) -> &'static str
pub fn source_of(&self, name: &str) -> &'static str
Return whether the named limit is still at its released default.
The answer is the source detail of a diagnostic raised against
that limit. A caller that merged in advertised limits overrides it
with LIMIT_SOURCE_ADVERTISED where the advertisement is binding.
Sourcepub fn annotate(self, diagnostic: Diagnostic) -> Diagnostic
pub fn annotate(self, diagnostic: Diagnostic) -> Diagnostic
Name the limit a resource-limit diagnostic was raised against.
Adds limit, maximum, and source details to a query
resource-limit diagnostic that does not carry them yet. Any other
diagnostic is returned unchanged.
Sourcepub fn annotate_refusal(diagnostic: Diagnostic, maximum: usize) -> Diagnostic
pub fn annotate_refusal(diagnostic: Diagnostic, maximum: usize) -> Diagnostic
Annotate a refusal raised by a stage that holds only the one ceiling it checked, such as a binding bounding a foreign sequence before it materializes it.
maximum is the ceiling that stage enforced. source is derived by
comparing it with the canonical default of the limit the code names.
Sourcepub fn annotate_negotiated(
self,
configured: QueryLimits,
diagnostic: Diagnostic,
) -> Diagnostic
pub fn annotate_negotiated( self, configured: QueryLimits, diagnostic: Diagnostic, ) -> Diagnostic
Self::annotate for limits merged from a caller’s own and an
executor’s advertisement.
self is the merged value. Where the advertisement is the stricter
side for the refused limit, source says so: raising the caller’s
own setting would not help.
Sourcepub fn mark_advertised(
self,
configured: QueryLimits,
diagnostic: Diagnostic,
) -> Diagnostic
pub fn mark_advertised( self, configured: QueryLimits, diagnostic: Diagnostic, ) -> Diagnostic
Set source to advertised on an annotated refusal whose limit the
advertisement tightened below the caller’s own value.
Sourcepub fn annotate_limit(
self,
diagnostic: Diagnostic,
limit: &'static str,
) -> Diagnostic
pub fn annotate_limit( self, diagnostic: Diagnostic, limit: &'static str, ) -> Diagnostic
Self::annotate for a diagnostic whose limit the caller knows
better than the code table, such as a codec failure of an envelope.
Trait Implementations§
Source§impl Clone for QueryLimits
impl Clone for QueryLimits
Source§fn clone(&self) -> QueryLimits
fn clone(&self) -> QueryLimits
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 QueryLimits
Source§impl Debug for QueryLimits
impl Debug for QueryLimits
Source§impl Default for QueryLimits
impl Default for QueryLimits
Source§fn default() -> QueryLimits
fn default() -> QueryLimits
impl Eq for QueryLimits
Source§impl PartialEq for QueryLimits
impl PartialEq for QueryLimits
impl StructuralPartialEq for QueryLimits
Auto Trait Implementations§
impl Freeze for QueryLimits
impl RefUnwindSafe for QueryLimits
impl Send for QueryLimits
impl Sync for QueryLimits
impl Unpin for QueryLimits
impl UnsafeUnpin for QueryLimits
impl UnwindSafe for QueryLimits
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
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> 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