pub struct RactorClusterEvents { /* private fields */ }Expand description
A dactor ClusterEvents implementation for the ractor adapter.
Provides a callback-based subscription system. In production, an
integration with ractor_cluster would feed real membership changes
into this subsystem via RactorClusterEvents::emit.
Implementations§
Source§impl RactorClusterEvents
impl RactorClusterEvents
Sourcepub fn emit(&self, event: ClusterEvent)
pub fn emit(&self, event: ClusterEvent)
Emit a cluster event, notifying all subscribers.
Callbacks are snapshot-cloned before invocation so that subscribers
may safely call subscribe or unsubscribe from within a callback
without deadlocking.
In production, this would be driven by ractor_cluster membership
change notifications. For testing, call this directly.
Trait Implementations§
Source§impl Clone for RactorClusterEvents
impl Clone for RactorClusterEvents
Source§fn clone(&self) -> RactorClusterEvents
fn clone(&self) -> RactorClusterEvents
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl ClusterEvents for RactorClusterEvents
impl ClusterEvents for RactorClusterEvents
Source§fn subscribe(
&self,
on_event: Box<dyn Fn(ClusterEvent) + Send + Sync>,
) -> Result<SubscriptionId, ClusterError>
fn subscribe( &self, on_event: Box<dyn Fn(ClusterEvent) + Send + Sync>, ) -> Result<SubscriptionId, ClusterError>
Subscribe to cluster membership changes. The callback is invoked for
each
ClusterEvent (NodeJoined, NodeLeft, NodeRejected).
Returns a SubscriptionId that can be used to cancel the
subscription.Source§fn unsubscribe(&self, id: SubscriptionId) -> Result<(), ClusterError>
fn unsubscribe(&self, id: SubscriptionId) -> Result<(), ClusterError>
Remove a previously registered subscription. Idempotent.
Auto Trait Implementations§
impl Freeze for RactorClusterEvents
impl RefUnwindSafe for RactorClusterEvents
impl Send for RactorClusterEvents
impl Sync for RactorClusterEvents
impl Unpin for RactorClusterEvents
impl UnsafeUnpin for RactorClusterEvents
impl UnwindSafe for RactorClusterEvents
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Message for T
impl<T> Message for T
Source§fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
Convert a BoxedMessage to this concrete type
Source§fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
Convert this message to a BoxedMessage