pub struct ReadBudget {
pub max_items: u32,
pub max_frame_bytes: u32,
pub max_snapshot_bytes: u64,
}Expand description
One budget vocabulary for observations, finite reads and transfer openings. For each field, zero chooses the advertised positive default; otherwise the effective value is min(requested, advertised maximum, current capacity). Above-maximum values MUST clamp, never cause rejection on that basis alone. Every endpoint (including devices/providers) MUST advertise maxima >= GUARANTEED_READ_BUDGET: 1024 items, 524288 frame bytes, 4194304 snapshot bytes. Effective fields MUST be >= min(resolved request, that floor). If capacity cannot meet this lower bound, fail retryably (UNAVAILABLE), never accept less. Reject only structurally impossible budgets from request shape, e.g. nonzero max_frame_bytes < 1024, snapshot bytes < frame bytes, or fixed selection overhead > max_items (INVALID_ARGUMENT), including per-method minima/reserves. Indivisible-result progress is guaranteed only for ListPaths and the four code-navigation methods, with explicit bounds/minima in cleanup-lane.md and code-navigation.md. Check minima before matching and bounds at admission. These methods return bounded PARTIAL/continuation for larger collections; their first visible row fits and unary results fit atomically. Other uncovered indivisible results, including ObserveRuns run/policy/timeline payloads, may not fit. After authorization/projection, if a whole record plus required controls cannot fit an empty legal batch, or a mandatory initial set cannot fit its snapshot, terminate before emitting/committing it with the existing CallFailure: RESOURCE_EXHAUSTED, message exactly “indivisible result exceeds read budget”, no ErrorDetail or retry hint. Reserve/charge one item and 128 bytes including framing for that failure per snapshot/batch; insufficient fixed overhead is INVALID_ARGUMENT before matching. If only the current batch is full, continue in a fresh bounded batch instead. Discard uncommitted staging; retain the last committed cursor. Never truncate, omit mandatory data, widen budgets or loop PARTIAL/Reset for a record that cannot fit. Do not automatically retry with the same budget. See streams.md. Existing blob chunks remain chunked; there is no generic chunk protocol.
Fields§
§max_items: u32Zero selects the endpoint’s advertised default; it never means unbounded. ObserveThread timeline charges every visible run and event frame, status, overview, removal and checkpoint against this one shared budget.
max_frame_bytes: u32§max_snapshot_bytes: u64Trait Implementations§
Source§impl Clone for ReadBudget
impl Clone for ReadBudget
Source§fn clone(&self) -> ReadBudget
fn clone(&self) -> ReadBudget
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 ReadBudget
Source§impl Debug for ReadBudget
impl Debug for ReadBudget
Source§impl Default for ReadBudget
impl Default for ReadBudget
Source§fn default() -> ReadBudget
fn default() -> ReadBudget
impl Eq for ReadBudget
Source§impl Hash for ReadBudget
impl Hash for ReadBudget
Source§impl Message for ReadBudget
impl Message for ReadBudget
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self.Source§impl PartialEq for ReadBudget
impl PartialEq for ReadBudget
impl StructuralPartialEq for ReadBudget
Auto Trait Implementations§
impl Freeze for ReadBudget
impl RefUnwindSafe for ReadBudget
impl Send for ReadBudget
impl Sync for ReadBudget
impl Unpin for ReadBudget
impl UnsafeUnpin for ReadBudget
impl UnwindSafe for ReadBudget
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§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 more