pub struct Engine<R: Reactor = TokioReactor, N: Network = TokioNetwork, F: FileSystem = TokioFileSystem> { /* private fields */ }Expand description
The single-engine actor runtime.
Generic over R: Reactor, N: Network, and F: FileSystem.
Production code uses TokioReactor, TokioNetwork, and TokioFileSystem.
Simulation tests swap these for virtual implementations.
Implementations§
Source§impl<R: Reactor, N: Network, F: FileSystem> Engine<R, N, F>
impl<R: Reactor, N: Network, F: FileSystem> Engine<R, N, F>
Sourcepub fn run(self, shutdown_rx: Receiver<()>)
pub fn run(self, shutdown_rx: Receiver<()>)
Launch the engine on a new current_thread Tokio runtime.
Blocks until shutdown_rx resolves. Use the returned EngineHandle
to interact with actors from the calling thread before calling run.
pub async fn run_async(self, shutdown_rx: Receiver<()>)
Source§impl Engine<TokioReactor, TokioNetwork, TokioFileSystem>
impl Engine<TokioReactor, TokioNetwork, TokioFileSystem>
pub fn new() -> Self
pub fn with_config(config: EngineConfig<TokioReactor>) -> Self
Source§impl<R: Reactor, N: Network, F: FileSystem> Engine<R, N, F>
impl<R: Reactor, N: Network, F: FileSystem> Engine<R, N, F>
Sourcepub fn with_reactor(
config: EngineConfig<R>,
reactor: R,
network: N,
fs: F,
) -> Self
pub fn with_reactor( config: EngineConfig<R>, reactor: R, network: N, fs: F, ) -> Self
Create an engine with a custom reactor. Used by pd-test to inject
SimReactor for deterministic simulation (Phase 3).
Create an engine with a shared transport (and its own fresh registry).
Used by pd-test’s run_multi to give all simulated engines access to
the same InProcessTransport so cross-engine actor-to-actor sends work
transparently without a real inter-core queue.
Sourcepub fn add_user_actor(&mut self, spec: ChildSpec<R>)
pub fn add_user_actor(&mut self, spec: ChildSpec<R>)
Register an actor to be spawned under /user at launch.
Sourcepub fn add_system_actor(&mut self, spec: ChildSpec<R>)
pub fn add_system_actor(&mut self, spec: ChildSpec<R>)
Register an actor to be spawned under /system at launch.
Sourcepub fn handle(&self) -> EngineHandle<R, N, F>
pub fn handle(&self) -> EngineHandle<R, N, F>
Return an EngineHandle for sending messages, building Addr<M>s, and
injecting faults.