pub struct Reactor { /* private fields */ }Expand description
The main reactor for event processing
Implementations§
Source§impl Reactor
impl Reactor
Sourcepub fn new(config: ReactorConfig) -> Result<Self, ReactorError>
pub fn new(config: ReactorConfig) -> Result<Self, ReactorError>
Creates a new reactor with the given configuration
§Errors
Currently does not return any errors, but may in the future if initialization fails
Sourcepub fn add_operator(&mut self, operator: Box<dyn Operator>)
pub fn add_operator(&mut self, operator: Box<dyn Operator>)
Register an operator in the processing chain
Sourcepub fn shutdown_handle(&self) -> Arc<AtomicBool> ⓘ
pub fn shutdown_handle(&self) -> Arc<AtomicBool> ⓘ
Get a handle to the shutdown flag
Sourcepub fn submit(&mut self, event: Event) -> Result<(), ReactorError>
pub fn submit(&mut self, event: Event) -> Result<(), ReactorError>
Submit an event for processing
§Errors
Returns ReactorError::QueueFull if the event queue is at capacity
Sourcepub fn submit_batch(&mut self, events: Vec<Event>) -> Result<(), ReactorError>
pub fn submit_batch(&mut self, events: Vec<Event>) -> Result<(), ReactorError>
Submit multiple events for processing
§Errors
Returns ReactorError::QueueFull if there’s insufficient capacity for all events
Sourcepub fn poll_into(&mut self, output: &mut Vec<Output>)
pub fn poll_into(&mut self, output: &mut Vec<Output>)
Run one iteration, appending outputs to a caller-provided buffer.
The caller can reuse the same Vec across iterations, retaining
its capacity and avoiding per-poll allocation.
Sourcepub fn advance_watermark(&mut self, timestamp: i64)
pub fn advance_watermark(&mut self, timestamp: i64)
Advances the watermark to the given timestamp.
Called when an external watermark message arrives (e.g., from TPC coordination).
Updates the reactor’s event time tracking and watermark generator state.
Any resulting watermark output will be included in the next poll() result.
Sourcepub fn trigger_checkpoint(&mut self) -> Vec<OperatorState>
pub fn trigger_checkpoint(&mut self) -> Vec<OperatorState>
Triggers a checkpoint by snapshotting all operator states.
Called when a CheckpointRequest arrives from the control plane.
Collects the serialized state from each operator and returns it
for persistence by Ring 1.
Sourcepub fn trigger_checkpoint_into(&mut self, buf: &mut Vec<OperatorState>)
pub fn trigger_checkpoint_into(&mut self, buf: &mut Vec<OperatorState>)
Triggers a checkpoint, appending operator states into a reusable buffer.
Like trigger_checkpoint but avoids
allocating a new Vec on every call — the caller provides a buffer
whose capacity is reused across checkpoint cycles.
Sourcepub fn events_processed(&self) -> u64
pub fn events_processed(&self) -> u64
Get the number of events processed
Sourcepub fn queue_size(&self) -> usize
pub fn queue_size(&self) -> usize
Get the number of events in the queue
Sourcepub fn set_cpu_affinity(&self) -> Result<(), ReactorError>
pub fn set_cpu_affinity(&self) -> Result<(), ReactorError>
Set CPU affinity if configured
§Errors
Returns ReactorError if CPU affinity cannot be set (platform-specific)
Auto Trait Implementations§
impl Freeze for Reactor
impl !RefUnwindSafe for Reactor
impl Send for Reactor
impl !Sync for Reactor
impl Unpin for Reactor
impl UnsafeUnpin for Reactor
impl !UnwindSafe for Reactor
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