Skip to main content

EventDelegate

Trait EventDelegate 

Source
pub trait EventDelegate:
    Send
    + Sync
    + 'static {
    type Id: Id;
    type Address: CheapClone + Send + Sync + 'static;

    // Required methods
    fn notify_join(
        &self,
        node: Arc<NodeState<Self::Id, Self::Address>>,
    ) -> impl Future<Output = ()> + Send;
    fn notify_leave(
        &self,
        node: Arc<NodeState<Self::Id, Self::Address>>,
    ) -> impl Future<Output = ()> + Send;
    fn notify_update(
        &self,
        node: Arc<NodeState<Self::Id, Self::Address>>,
    ) -> impl Future<Output = ()> + Send;
}
Expand description

A simpler delegate that is used only to receive notifications about members joining and leaving. The methods in this delegate may be called by multiple threads, but never concurrently. This allows you to reason about ordering.

Required Associated Types§

Source

type Id: Id

The id type of the delegate

Source

type Address: CheapClone + Send + Sync + 'static

The address type of the delegate

Required Methods§

Source

fn notify_join( &self, node: Arc<NodeState<Self::Id, Self::Address>>, ) -> impl Future<Output = ()> + Send

Invoked when a node is detected to have joined the cluster

Source

fn notify_leave( &self, node: Arc<NodeState<Self::Id, Self::Address>>, ) -> impl Future<Output = ()> + Send

Invoked when a node is detected to have left the cluster

Source

fn notify_update( &self, node: Arc<NodeState<Self::Id, Self::Address>>, ) -> impl Future<Output = ()> + Send

Invoked when a node is detected to have updated, usually involving the meta data.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: EventDelegate + ?Sized> EventDelegate for Arc<T>
where Arc<T>: Send + Sync + 'static,

Source§

type Id = <T as EventDelegate>::Id

Source§

type Address = <T as EventDelegate>::Address

Source§

fn notify_join( &self, node: Arc<NodeState<Self::Id, Self::Address>>, ) -> impl Future<Output = ()> + Send

Source§

fn notify_leave( &self, node: Arc<NodeState<Self::Id, Self::Address>>, ) -> impl Future<Output = ()> + Send

Source§

fn notify_update( &self, node: Arc<NodeState<Self::Id, Self::Address>>, ) -> impl Future<Output = ()> + Send

Source§

impl<T: EventDelegate + ?Sized> EventDelegate for Box<T>
where Box<T>: Send + Sync + 'static,

Source§

type Id = <T as EventDelegate>::Id

Source§

type Address = <T as EventDelegate>::Address

Source§

fn notify_join( &self, node: Arc<NodeState<Self::Id, Self::Address>>, ) -> impl Future<Output = ()> + Send

Source§

fn notify_leave( &self, node: Arc<NodeState<Self::Id, Self::Address>>, ) -> impl Future<Output = ()> + Send

Source§

fn notify_update( &self, node: Arc<NodeState<Self::Id, Self::Address>>, ) -> impl Future<Output = ()> + Send

Implementors§

Source§

impl<I, A> EventDelegate for SubscribleEventDelegate<I, A>
where I: Id + Send + Sync + 'static, A: CheapClone + Send + Sync + 'static,

Source§

type Id = I

Source§

type Address = A

Source§

impl<I, A> EventDelegate for VoidDelegate<I, A>
where I: Id + Send + Sync + 'static, A: CheapClone + Send + Sync + 'static,

Source§

type Id = I

Source§

type Address = A

Source§

impl<I, Address, A, C, E, M, N, P> EventDelegate for CompositeDelegate<I, Address, A, C, E, M, N, P>
where I: Id + Send + Sync + 'static, Address: CheapClone + Send + Sync + 'static, A: AliveDelegate<Id = I, Address = Address>, C: ConflictDelegate<Id = I, Address = Address>, E: EventDelegate<Id = I, Address = Address>, M: MergeDelegate<Id = I, Address = Address>, N: NodeDelegate, P: PingDelegate<Id = I, Address = Address>,

Source§

type Id = I

Source§

type Address = Address