Skip to main content

Engine

Struct Engine 

Source
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>

Source

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.

Source

pub async fn run_async(self, shutdown_rx: Receiver<()>)

Source§

impl Engine<TokioReactor, TokioNetwork, TokioFileSystem>

Source

pub fn new() -> Self

Source

pub fn with_config(config: EngineConfig<TokioReactor>) -> Self

Source§

impl<R: Reactor, N: Network, F: FileSystem> Engine<R, N, F>

Source

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).

Source

pub fn with_shared_transport( config: EngineConfig<R>, reactor: R, network: N, fs: F, transport: Arc<InProcessTransport>, ) -> Self

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.

Source

pub fn add_user_actor(&mut self, spec: ChildSpec<R>)

Register an actor to be spawned under /user at launch.

Source

pub fn add_system_actor(&mut self, spec: ChildSpec<R>)

Register an actor to be spawned under /system at launch.

Source

pub fn handle(&self) -> EngineHandle<R, N, F>

Return an EngineHandle for sending messages, building Addr<M>s, and injecting faults.

Source

pub fn enable_federated_routing( &mut self, registry: Arc<RwLock<FederatedRegistry>>, policy: FederationPolicy, ) -> Arc<FederatedRouting>

Trait Implementations§

Source§

impl Default for Engine<TokioReactor, TokioNetwork, TokioFileSystem>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<R, N, F> Freeze for Engine<R, N, F>
where R: Freeze, N: Freeze, F: Freeze,

§

impl<R = TokioReactor, N = TokioNetwork, F = TokioFileSystem> !RefUnwindSafe for Engine<R, N, F>

§

impl<R, N, F> Send for Engine<R, N, F>

§

impl<R, N, F> Sync for Engine<R, N, F>

§

impl<R, N, F> Unpin for Engine<R, N, F>
where R: Unpin, N: Unpin, F: Unpin,

§

impl<R, N, F> UnsafeUnpin for Engine<R, N, F>

§

impl<R = TokioReactor, N = TokioNetwork, F = TokioFileSystem> !UnwindSafe for Engine<R, N, F>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T, U> Upcast<T> for U
where T: UpcastFrom<U>,

Source§

fn upcast(self) -> T

Source§

impl<T, B> UpcastFrom<Counter<T, B>> for T

Source§

fn upcast_from(value: Counter<T, B>) -> T

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V