Skip to main content

Backplane

Trait Backplane 

Source
pub trait Backplane: Send + Sync {
    // Required methods
    fn publish<'life0, 'async_trait>(
        &'life0 self,
        message: BackplaneMessage,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn subscribe(&self) -> Receiver<BackplaneMessage>;
}
Expand description

A multi-node notification channel.

Implement over Redis pub/sub, NATS, etc. The cache publishes on local changes and subscribes to apply remote ones.

Required Methods§

Source

fn publish<'life0, 'async_trait>( &'life0 self, message: BackplaneMessage, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Publishes a message to all other subscribers.

§Errors

Returns Error::Backplane on transport failure.

Source

fn subscribe(&self) -> Receiver<BackplaneMessage>

Subscribes to the message stream.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§