Skip to main content

Module batch_source

Module batch_source 

Source
Expand description

BatchSource — the multi-consumer (&self) owned-batch source.

The algebra’s third source flavor, filling the gap between the two single-consumer sources:

  • DrainSource — &mut self, zero-copy borrow-visitor (the *DK frame relay).
  • FanIn’s UnpinPipe sources — &self, owned async pull.
  • BatchSource — &self, owned batch pull, safe for many concurrent drainers. A lock-free MPMC ring (proxima_core::ring::BoundedQueue) is the canonical impl: several threads can each pull a disjoint batch at once, which is what lets a drainer partition work across cores and lift the single-drainer ceiling. The single-consumer sources cannot express that — &mut self is one owner by construction.

A consumer drives it by handing a scratch slice to fill: drain_batch(&mut [Item]) -> count. No alloc, no waker, no &mut self — legal at T0.

Traits§

BatchSource
A source drained in owned batches through a shared &self, so multiple consumers may pull disjoint batches concurrently.