Trait blip::overlay::MeshService
source · [−]pub trait MeshService: Send {
fn accept<'async_trait>(
self: Box<Self>,
cuts: Subscription
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where
Self: 'async_trait;
}
Expand description
A service that has access to accepted membership view-change proposals.
Examples
use blip::{MeshService, Subscription};
struct MySvc;
#[blip::async_trait]
impl MeshService for MySvc {
async fn accept(self: Box<Self>, mut cuts: Subscription) {
while let Ok(cut) = cuts.recv().await {
// handle membership change
let _ = cut.members();
let _ = cut.joined();
let _ = cut.kicked();
}
}
}
Required Methods
Receive accepted view-change proposals.
This method is called once for every MeshService added to a Mesh, and will be polled for the entire period the mesh remains online. Resolving early is fine and does not constitute an error.
Blocking (of the non-async variety) within this future should never happen, and will starve the executor if it does.
If the mesh exits (for any reason), this future will be dropped if it has not yet resolved (which may occur at any yield point).
Implementors
impl MeshService for Cache
Available on crate feature
cache
only.