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>
Sourcepub async fn request_stop(&self, proc: &ProcId, timeout: Duration, reason: &str)
pub async fn request_stop(&self, proc: &ProcId, timeout: Duration, reason: &str)
Non-blocking stop: remove the proc and spawn a background task that tears it down.
Status transitions through Stopping -> Stopped and is
observable via [local_proc_status]. Idempotent: no-ops if
the proc is already stopping or stopped.
Sourcepub async fn local_proc_status(&self, proc: &ProcId) -> Option<LocalProcStatus>
pub async fn local_proc_status(&self, proc: &ProcId) -> Option<LocalProcStatus>
Query the lifecycle status of a proc that was stopped via
[request_stop].
Returns None if the proc was never stopped through this path.
Trait Implementations§
Source§impl<S> BulkTerminate for LocalProcManager<S>
impl<S> BulkTerminate for LocalProcManager<S>
Source§fn terminate_all<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_cx: &'life1 (impl 'async_trait + Actor),
timeout: Duration,
max_in_flight: usize,
reason: &'life2 str,
) -> Pin<Box<dyn Future<Output = TerminateSummary> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn terminate_all<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_cx: &'life1 (impl 'async_trait + Actor),
timeout: Duration,
max_in_flight: usize,
reason: &'life2 str,
) -> Pin<Box<dyn Future<Output = TerminateSummary> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
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::spawnit).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>
Source§fn transport(&self) -> ChannelTransport
fn transport(&self) -> ChannelTransport
ChannelTransport::Local
for testing, and ChannelTransport::Unix for external
processes.Source§fn spawn<'life0, 'async_trait>(
&'life0 self,
proc_id: ProcId,
forwarder_addr: ChannelAddr,
_config: (),
) -> 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,
_config: (),
) -> Pin<Box<dyn Future<Output = Result<Self::Handle, HostError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§impl<S> SingleTerminate for LocalProcManager<S>
impl<S> SingleTerminate for LocalProcManager<S>
Source§fn terminate_proc<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_cx: &'life1 (impl 'async_trait + Actor),
proc: &'life2 ProcId,
timeout: Duration,
reason: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(Vec<ActorId>, Vec<ActorId>), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn terminate_proc<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_cx: &'life1 (impl 'async_trait + Actor),
proc: &'life2 ProcId,
timeout: Duration,
reason: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(Vec<ActorId>, Vec<ActorId>), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
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
§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>
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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].