pub struct Host<M> { /* private fields */ }Expand description
A host, managing the lifecycle of several procs, and their backend routing, as described in this module’s documentation.
Implementations§
Source§impl<M: ProcManager> Host<M>
impl<M: ProcManager> Host<M>
Sourcepub async fn serve(
manager: M,
addr: ChannelAddr,
) -> Result<(Self, MailboxServerHandle), HostError>
pub async fn serve( manager: M, addr: ChannelAddr, ) -> Result<(Self, MailboxServerHandle), HostError>
Serve a host using the provided ProcManager, on the provided addr.
On success, the host will multiplex messages for procs on the host
on the address of the host.
Sourcepub fn addr(&self) -> &ChannelAddr
pub fn addr(&self) -> &ChannelAddr
The address which accepts messages destined for this host.
Sourcepub fn system_proc(&self) -> &Proc
pub fn system_proc(&self) -> &Proc
The system proc associated with this host.
Sourcepub async fn spawn(
&mut self,
name: String,
config: M::Config,
) -> Result<(ProcId, ActorRef<ManagerAgent<M>>), HostError>
pub async fn spawn( &mut self, name: String, config: M::Config, ) -> Result<(ProcId, ActorRef<ManagerAgent<M>>), HostError>
Spawn a new process with the given name. On success, the proc has been
spawned, and is reachable through the returned, direct-addressed ProcId,
which will be ProcId::Direct(self.addr(), name).
Source§impl<M: ProcManager + BulkTerminate> Host<M>
impl<M: ProcManager + BulkTerminate> Host<M>
Sourcepub async fn terminate_children(
&self,
cx: &impl Actor,
timeout: Duration,
max_in_flight: usize,
) -> TerminateSummary
pub async fn terminate_children( &self, cx: &impl Actor, timeout: Duration, max_in_flight: usize, ) -> TerminateSummary
Gracefully terminate all procs spawned by this host.
Delegates to the underlying manager’s
BulkTerminate::terminate_all implementation. Use this to
perform orderly teardown during scale-down or shutdown.
§Parameters
timeout: Per-child grace period before escalation.max_in_flight: Upper bound on concurrent terminations.
§Returns
A TerminateSummary with counts of attempted/ok/failed
terminations.
Trait Implementations§
Source§impl<M: ProcManager + SingleTerminate> SingleTerminate for Host<M>
impl<M: ProcManager + SingleTerminate> SingleTerminate for Host<M>
Source§fn terminate_proc<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
cx: &'life1 (impl 'async_trait + Actor),
proc: &'life2 ProcId,
timeout: Duration,
) -> 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,
fn terminate_proc<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
cx: &'life1 (impl 'async_trait + Actor),
proc: &'life2 ProcId,
timeout: Duration,
) -> 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,
Auto Trait Implementations§
impl<M> Freeze for Host<M>where
M: Freeze,
impl<M> !RefUnwindSafe for Host<M>
impl<M> Send for Host<M>where
M: Send,
impl<M> Sync for Host<M>where
M: Sync,
impl<M> Unpin for Host<M>where
M: Unpin,
impl<M> !UnwindSafe for Host<M>
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