pub struct BarrierAligner { /* private fields */ }Expand description
Buffers events at fan-in (MPSC) nodes until all upstream inputs have delivered their checkpoint barrier.
For nodes with a single input (expected_inputs == 1), alignment
is immediate — no buffering occurs.
Implementations§
Source§impl BarrierAligner
impl BarrierAligner
Sourcepub fn new(expected_inputs: usize) -> Self
pub fn new(expected_inputs: usize) -> Self
Creates a new barrier aligner for a node with expected_inputs upstream edges.
Sourcepub fn on_barrier(
&mut self,
source_node: NodeId,
barrier: CheckpointBarrier,
) -> AlignmentResult
pub fn on_barrier( &mut self, source_node: NodeId, barrier: CheckpointBarrier, ) -> AlignmentResult
Processes a barrier arriving from source_node.
Returns AlignmentResult::Pending until all inputs have reported,
then returns AlignmentResult::Aligned with the barrier and any
buffered events sorted by event timestamp.
§Cross-input ordering
Buffered events from different upstream inputs are merged and sorted
by event.timestamp to ensure deterministic event-time ordering at
fan-in nodes. Operators that require event-time ordering can rely on
this guarantee for the post-alignment batch.
§Panics
Panics if the internal barrier map is empty after insertion (should never happen).
Sourcepub fn buffer_if_aligned(&mut self, source_node: NodeId, event: Event) -> bool
pub fn buffer_if_aligned(&mut self, source_node: NodeId, event: Event) -> bool
Buffers an event from source_node if that source has already
delivered its barrier for the current checkpoint.
Returns true if the event was buffered (source already aligned),
false if the source has not yet delivered its barrier (event should
be processed normally).
Sourcepub fn is_source_aligned(&self, source_node: NodeId) -> bool
pub fn is_source_aligned(&self, source_node: NodeId) -> bool
Returns whether source_node has already delivered its barrier.
Sourcepub fn complete_checkpoint(&mut self)
pub fn complete_checkpoint(&mut self)
Resets alignment state after a checkpoint completes.
Sourcepub fn barriers_received_count(&self) -> usize
pub fn barriers_received_count(&self) -> usize
Returns how many barriers have been received so far.
Sourcepub fn expected_inputs(&self) -> usize
pub fn expected_inputs(&self) -> usize
Returns the expected number of upstream inputs.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BarrierAligner
impl !RefUnwindSafe for BarrierAligner
impl Send for BarrierAligner
impl Sync for BarrierAligner
impl Unpin for BarrierAligner
impl UnsafeUnpin for BarrierAligner
impl !UnwindSafe for BarrierAligner
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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