Struct PushBatch
#[non_exhaustive]pub struct PushBatch {
pub groups: Vec<EventGroup>,
}Expand description
A batch of events crossing the boundary, decomposed into the groups that must land atomically.
The decomposition is on the wire and explicit, not left for the receiver to infer. Each group is a set of events that one origin-side decision wrote together under one guard; a receiver that flattened the batch and appended event-by-event would publish a state the origin never had, and no amount of ordering fixes that.
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.groups: Vec<EventGroup>The groups, in forwarding order.
Implementations§
§impl PushBatch
impl PushBatch
pub const fn empty() -> Self
pub const fn empty() -> Self
An empty batch: the far side has nothing new.
pub const fn new(groups: Vec<EventGroup>) -> Self
pub const fn new(groups: Vec<EventGroup>) -> Self
Assembles a batch from its groups.
pub fn events(&self) -> impl Iterator<Item = &ReplicatedEvent> + '_
pub fn events(&self) -> impl Iterator<Item = &ReplicatedEvent> + '_
Every event in the batch, flattened, in forwarding order.
For counting and for size checks. Ingest must not use this: flattening is
exactly what EventGroup exists to prevent.
pub fn payload_len(&self) -> usize
pub fn payload_len(&self) -> usize
Total payload bytes, for checking against
PeerLimits::max_batch_bytes.