Skip to main content

PeerLimits

Struct PeerLimits 

#[non_exhaustive]
pub struct PeerLimits { pub max_event_bytes: usize, pub max_batch_bytes: usize, pub max_batch_events: usize, pub retention_floor: Option<EventId>, }
Expand description

What a peer can accept.

Read before pushing. The contract bounds an event type and a tag at 255 bytes each and leaves the payload unbounded, so an event that is durable at its origin can be structurally unrepresentable at a peer — a KV-backed store with a 128 KiB value cap against an origin that has already committed 340 KB.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§max_event_bytes: usize

Largest single event payload, in bytes.

A peer below the contract’s own floor is non-conformant, not merely small.

§max_batch_bytes: usize

Largest total payload in one push, in bytes.

The one-shot HTTP peer’s ceiling is a response size, and it is the reason this is separate from max_event_bytes: a peer can be fine with a large event and unable to carry sixty of them.

§max_batch_events: usize

Largest number of events in one push.

§retention_floor: Option<EventId>

The newest event this peer has pruned, if any: a token must have reached it to resume. ADR-0028 (.kb/decisions/0028-what-a-store-may-forget.md:236-237) says “the lowest resume point this peer can still satisfy”: the same under a token’s “after” reading, and #163 reconciles the words. A pull below it fails Reseed and is reported, not retried (SY-32). Nothing above it is promised kept. None: no pruning.

Implementations§

§

impl PeerLimits

pub const fn minimum() -> Self

The smallest limits a conformant peer may declare.

64 KiB per event is the contract’s own floor for what a store must accept; a peer that cannot manage that is not a peer.

pub fn admits(&self, batch: &PushBatch) -> bool

Whether batch fits inside these limits.

Advisory. A peer still has to check on arrival, because limits read before a push can be stale by the time it lands.

Trait Implementations§

§

impl Clone for PeerLimits

§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for PeerLimits

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl Eq for PeerLimits

§

impl From<&PeerLimits> for PullBatchLimit

§

fn from(limits: &PeerLimits) -> Self

Converts to this type from the input type.
§

impl PartialEq for PeerLimits

§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
§

impl StructuralPartialEq for PeerLimits

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.