serf_core/delegate.rs
1use memberlist_core::{CheapClone, transport::Id};
2
3mod merge;
4pub use merge::*;
5
6mod reconnect;
7pub use reconnect::*;
8
9mod composite;
10pub use composite::*;
11
12/// [`Delegate`] is the trait that clients must implement if they want to hook
13/// into the gossip layer of [`Serf`](crate::Serf). All the methods must be thread-safe,
14/// as they can and generally will be called concurrently.
15pub trait Delegate:
16 MergeDelegate<Id = <Self as Delegate>::Id, Address = <Self as Delegate>::Address>
17 + ReconnectDelegate<Id = <Self as Delegate>::Id, Address = <Self as Delegate>::Address>
18{
19 /// The id type of the delegate
20 type Id: Id;
21 /// The address type of the delegate
22 type Address: CheapClone + Send + Sync + 'static;
23}