pub struct ContextRuntime { /* private fields */ }Expand description
A self-contained single-threaded runtime for one context.
Owns its streams, processes events without locks. Receives events from its inbound channel and forwards cross-context events via outbound channels.
Implementations§
Source§impl ContextRuntime
impl ContextRuntime
Sourcepub const fn new(
name: String,
engine: Engine,
output_tx: Sender<Event>,
event_rx: Receiver<ContextMessage>,
engine_output_rx: Receiver<Event>,
all_context_txs: FxHashMap<String, Sender<ContextMessage>>,
ingress_routing: FxHashMap<String, String>,
shutdown_rx: Receiver<bool>,
) -> Self
pub const fn new( name: String, engine: Engine, output_tx: Sender<Event>, event_rx: Receiver<ContextMessage>, engine_output_rx: Receiver<Event>, all_context_txs: FxHashMap<String, Sender<ContextMessage>>, ingress_routing: FxHashMap<String, String>, shutdown_rx: Receiver<bool>, ) -> Self
Create a new context runtime
Sourcepub fn with_ack_sender(self, ack_tx: Sender<CheckpointAck>) -> Self
pub fn with_ack_sender(self, ack_tx: Sender<CheckpointAck>) -> Self
Set the checkpoint acknowledgment sender for coordinated checkpointing.
Sourcepub async fn run(&mut self)
pub async fn run(&mut self)
Run the event loop. Blocks the current thread.
Receives events from the inbound channel, processes them through the engine, and forwards cross-context events as needed.
If the engine has session windows, a periodic sweep timer runs
every gap duration to close stale sessions. This ensures sessions
are emitted even when no new events arrive.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ContextRuntime
impl !RefUnwindSafe for ContextRuntime
impl Send for ContextRuntime
impl Sync for ContextRuntime
impl Unpin for ContextRuntime
impl UnsafeUnpin for ContextRuntime
impl !UnwindSafe for ContextRuntime
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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