pub struct LocalProcManager<S> { /* private fields */ }
Expand description
A ProcManager that spawns in-process procs (test-only).
The proc runs inside this same OS process; there is no child process to signal. Lifecycle is purely proc-level:
-
terminate(timeout)
: delegates toProc::destroy_and_wait(timeout, None)
, which drains and, at the deadline, aborts remaining actors. -
kill()
: uses a zero deadline to emulate a forced stop viadestroy_and_wait(Duration::ZERO, None)
. -
wait()
: trivial (no external lifecycle to observe).No OS signals are sent or required.
Implementations§
Source§impl<S> LocalProcManager<S>
impl<S> LocalProcManager<S>
Trait Implementations§
Source§impl<S> BulkTerminate for LocalProcManager<S>
impl<S> BulkTerminate for LocalProcManager<S>
Source§impl<A, S, F> ProcManager for LocalProcManager<S>
Local, in-process ProcManager.
impl<A, S, F> ProcManager for LocalProcManager<S>
Local, in-process ProcManager.
Type bounds:
A: Actor + Referable + Binds<A>
Actor
: the agent actually runs inside the proc.Referable
: callers holdActorRef<A>
to the agent; this bound is required for typed remote refs.Binds<A>
: lets the runtime wire the agent’s message ports.
F: Future<Output = anyhow::Result<ActorHandle<A>>> + Send
: the spawn closure returns a Send future (wetokio::spawn
it).S: Fn(Proc) -> F + Sync
: the factory can be called from concurrent contexts.
Result handle is LocalHandle<A>
(whose Agent = A
via ProcHandle
).
Source§type Handle = LocalHandle<A>
type Handle = LocalHandle<A>
Concrete handle type this manager returns.
Source§fn transport(&self) -> ChannelTransport
fn transport(&self) -> ChannelTransport
The preferred transport for this ProcManager.
In practice this will be
ChannelTransport::Local
for testing, and ChannelTransport::Unix
for external
processes.Source§fn spawn<'life0, 'async_trait>(
&'life0 self,
proc_id: ProcId,
forwarder_addr: ChannelAddr,
) -> Pin<Box<dyn Future<Output = Result<Self::Handle, HostError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn spawn<'life0, 'async_trait>(
&'life0 self,
proc_id: ProcId,
forwarder_addr: ChannelAddr,
) -> Pin<Box<dyn Future<Output = Result<Self::Handle, HostError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Spawn a new proc with the provided proc id. The proc
should use the provided forwarder address for messages
destined outside of the proc. The returned address accepts
messages destined for the proc. Read more
Auto Trait Implementations§
impl<S> Freeze for LocalProcManager<S>where
S: Freeze,
impl<S> !RefUnwindSafe for LocalProcManager<S>
impl<S> Send for LocalProcManager<S>where
S: Send,
impl<S> Sync for LocalProcManager<S>where
S: Sync,
impl<S> Unpin for LocalProcManager<S>where
S: Unpin,
impl<S> !UnwindSafe for LocalProcManager<S>
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<A, M> Handler<IndexedErasedUnbound<M>> for A
impl<A, M> Handler<IndexedErasedUnbound<M>> for A
§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>
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