[][src]Trait blip::MeshService

pub trait MeshService: Send {
#[must_use]    fn accept<'async_trait>(
        self: Box<Self>,
        cuts: Subscription
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        Self: 'async_trait
; }

A trait that allows individual services access to any 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

#[must_use]fn accept<'async_trait>(
    self: Box<Self>,
    cuts: Subscription
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
    Self: 'async_trait, 

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).

Loading content...

Implementors

impl MeshService for Cache[src]

impl<S: Send> MeshService for GrpcService<S>[src]

Loading content...