pub struct MeshMonitor { /* private fields */ }Expand description
A liveness monitor over a set of ranked actors.
A MeshMonitor logically monitors one actor per rank in a region. Monitoring
runs until the MeshMonitor is dropped. A monitor from MeshMonitor::spawn_persistent
is persistent and polls throughout; one from MeshMonitor::spawn_dormant
starts dormant and polls only while active. Awaiting a &MeshMonitor
resolves with the first rank failure, reported as a MeshFailure that
names the rank; use MeshMonitor::guard to run a future until it completes
or a rank fails.
Implementations§
Source§impl MeshMonitor
impl MeshMonitor
Sourcepub fn spawn_persistent(cx: &impl Actor, actors: ValueMesh<ActorAddr>) -> Self
pub fn spawn_persistent(cx: &impl Actor, actors: ValueMesh<ActorAddr>) -> Self
Spawn one persistent ActorMonitor per rank as a child of cx.
actors holds the actor addresses in the mesh’s region, so the resulting
monitors share that region: each rank reports failures under the same rank
it holds in the mesh.
Sourcepub fn spawn_dormant(cx: &impl Actor, actors: ValueMesh<ActorAddr>) -> Self
pub fn spawn_dormant(cx: &impl Actor, actors: ValueMesh<ActorAddr>) -> Self
Spawn one ActorMonitor per rank as a child of cx, starting dormant.
Each rank observes terminal-status notifications in either state, but
polls status only while active: while a MeshMonitorActivation from
Self::activate is live.
Sourcepub fn activate(&self, cx: &impl Actor) -> MeshMonitorActivation
pub fn activate(&self, cx: &impl Actor) -> MeshMonitorActivation
Keep every rank active until the returned activation is dropped.
Sourcepub fn status(&self, rank: usize) -> Option<ActorStatus>
pub fn status(&self, rank: usize) -> Option<ActorStatus>
Return the latest observed status for rank.
Sourcepub async fn guard<F>(&self, fut: F) -> Result<F::Output, MeshFailure>where
F: Future,
pub async fn guard<F>(&self, fut: F) -> Result<F::Output, MeshFailure>where
F: Future,
Run fut until it completes or any monitored rank fails.
Sourcepub async fn cast_and_collect<A, M, R>(
&self,
actor_mesh: &ActorMeshRef<A>,
cx: &impl Actor,
message: M,
receiver: &mut PortReceiver<R>,
) -> Result<Result<Vec<R>, MeshFailure>>
pub async fn cast_and_collect<A, M, R>( &self, actor_mesh: &ActorMeshRef<A>, cx: &impl Actor, message: M, receiver: &mut PortReceiver<R>, ) -> Result<Result<Vec<R>, MeshFailure>>
Cast message and collect one response per rank unless a rank fails.
receiver must receive exactly one response from each actor in
actor_mesh. Responses are returned in arrival order. The outer result
reports cast or mailbox errors; the inner result distinguishes all-rank
completion from a monitored rank failure. This monitor must have been
created from actor_mesh.
Trait Implementations§
Source§impl<'a> IntoFuture for &'a MeshMonitor
Awaiting a &MeshMonitor resolves with the first rank failure. The borrow
keeps the monitors alive for the duration of the await.
impl<'a> IntoFuture for &'a MeshMonitor
Awaiting a &MeshMonitor resolves with the first rank failure. The borrow
keeps the monitors alive for the duration of the await.
Source§type Output = MeshFailure
type Output = MeshFailure
Source§type IntoFuture = Pin<Box<dyn Future<Output = MeshFailure> + Send + 'a>>
type IntoFuture = Pin<Box<dyn Future<Output = MeshFailure> + Send + 'a>>
Source§fn into_future(self) -> Self::IntoFuture
fn into_future(self) -> Self::IntoFuture
Auto Trait Implementations§
impl !RefUnwindSafe for MeshMonitor
impl !UnwindSafe for MeshMonitor
impl Freeze for MeshMonitor
impl Send for MeshMonitor
impl Sync for MeshMonitor
impl Unpin for MeshMonitor
impl UnsafeUnpin for MeshMonitor
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§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>
§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].