pub struct HostMeshShutdownGuard(pub HostMesh);Expand description
Wrapper around HostMesh that runs shutdown on Drop.
Tuple Fields§
§0: HostMeshMethods from Deref<Target = HostMesh>§
Sourcepub async fn shutdown(&mut self, cx: &impl Actor) -> Result<()>
pub async fn shutdown(&mut self, cx: &impl Actor) -> Result<()>
Request a clean shutdown of all hosts owned by this
HostMesh.
Uses a two-phase approach:
- Terminate children on every host concurrently. Service infrastructure (host agent, comm proc, networking) stays alive so that forwarder flushes can still reach remote hosts.
- Shut down hosts concurrently. No user procs remain, so this is fast and cannot deadlock on cross-host flush timeouts.
Sourcepub async fn stop(&mut self, cx: &impl Actor) -> Result<()>
pub async fn stop(&mut self, cx: &impl Actor) -> Result<()>
Stop all hosts owned by this HostMesh, draining user procs
but keeping worker processes and their sockets alive for
reconnection.
After stop, the same worker addresses can be passed to
HostMesh::attach to create a new mesh.
Sourcepub fn set_bootstrap(&mut self, cmd: BootstrapCommand)
pub fn set_bootstrap(&mut self, cmd: BootstrapCommand)
Set the bootstrap command on the underlying HostMeshRef,
so that future spawn calls use it. Unlike
HostMeshRef::with_bootstrap this mutates in place,
preserving ownership.
Methods from Deref<Target = HostMeshRef>§
Sourcepub async fn spawn<C: Actor>(
&self,
cx: &C,
name: &str,
per_host: Extent,
proc_bind: Option<Vec<ProcBind>>,
) -> Result<ProcMesh>
pub async fn spawn<C: Actor>( &self, cx: &C, name: &str, per_host: Extent, proc_bind: Option<Vec<ProcBind>>, ) -> Result<ProcMesh>
Spawn a ProcMesh onto this host mesh. The per_host extent specifies the shape of the procs to spawn on each host.
proc_bind, when provided, is a per-process CPU/NUMA binding
configuration. Its length must equal the number of ranks in
per_host. Each entry maps binding keys (cpunodebind,
membind, physcpubind, cpus) to their values.
Only takes effect when running on Linux.
Currently, spawn issues direct calls to each host agent. This will be fixed by maintaining a comm actor on the host service procs themselves.
Trait Implementations§
Source§impl Deref for HostMeshShutdownGuard
impl Deref for HostMeshShutdownGuard
Source§impl DerefMut for HostMeshShutdownGuard
impl DerefMut for HostMeshShutdownGuard
Source§impl Drop for HostMeshShutdownGuard
impl Drop for HostMeshShutdownGuard
Source§fn drop(&mut self)
fn drop(&mut self)
Best-effort cleanup for owned host meshes on drop.
When a HostMesh is dropped, it attempts to shut down all
hosts it owns:
- If a Tokio runtime is available, we spawn an ephemeral
Proc+Instanceand sendShutdownHostmessages to each host. This ensures that the embeddedBootstrapProcManagers are dropped, and all child procs they spawned are killed. - If no runtime is available, we cannot perform async cleanup
here; in that case we log a warning and rely on kernel-level
PDEATHSIG or the individual
BootstrapProcManager’sDropas the final safeguard.
This path is last resort: callers should prefer explicit
HostMesh::shutdown to guarantee orderly teardown. Drop
only provides opportunistic cleanup to prevent process leaks
if shutdown is skipped.
Auto Trait Implementations§
impl Freeze for HostMeshShutdownGuard
impl RefUnwindSafe for HostMeshShutdownGuard
impl Send for HostMeshShutdownGuard
impl Sync for HostMeshShutdownGuard
impl Unpin for HostMeshShutdownGuard
impl UnwindSafe for HostMeshShutdownGuard
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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].