Backend

Trait Backend 

Source
pub trait Backend<M: MessageMetadata> {
    // Required methods
    fn store_outbound<'life0, 'async_trait>(
        &'life0 self,
        message: M,
    ) -> Pin<Box<dyn Future<Output = Result<(), BackendError<M>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn store_inbound<'life0, 'async_trait>(
        &'life0 self,
        message: M,
    ) -> Pin<Box<dyn Future<Output = Result<(), BackendError<M>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn clear_message_inbound<'life0, 'async_trait>(
        &'life0 self,
        peer_id: M::PeerId,
        message_id: M::MessageId,
    ) -> Pin<Box<dyn Future<Output = Result<(), BackendError<M>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn clear_message_outbound<'life0, 'async_trait>(
        &'life0 self,
        peer_id: M::PeerId,
        message_id: M::MessageId,
    ) -> Pin<Box<dyn Future<Output = Result<(), BackendError<M>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_pending_outbound<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<M>, BackendError<M>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_pending_inbound<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<M>, BackendError<M>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn store_value<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
        value: &'life2 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<(), BackendError<M>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn load_value<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, BackendError<M>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Each local client that uses a backend needs to have a different backend in order to not have collisions in the message tracker

Required Methods§

Source

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

Source

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

Source

fn clear_message_inbound<'life0, 'async_trait>( &'life0 self, peer_id: M::PeerId, message_id: M::MessageId, ) -> Pin<Box<dyn Future<Output = Result<(), BackendError<M>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn clear_message_outbound<'life0, 'async_trait>( &'life0 self, peer_id: M::PeerId, message_id: M::MessageId, ) -> Pin<Box<dyn Future<Output = Result<(), BackendError<M>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_pending_outbound<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<M>, BackendError<M>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_pending_inbound<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<M>, BackendError<M>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn store_value<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, key: &'life1 str, value: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = Result<(), BackendError<M>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn load_value<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, BackendError<M>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementations on Foreign Types§

Source§

impl<'a, M: MessageMetadata, T: 'a + Backend<M> + ?Sized> Backend<M> for &'a T

Source§

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

Source§

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

Source§

fn clear_message_inbound<'life0, 'async_trait>( &'life0 self, peer_id: M::PeerId, message_id: M::MessageId, ) -> Pin<Box<dyn Future<Output = Result<(), BackendError<M>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn clear_message_outbound<'life0, 'async_trait>( &'life0 self, peer_id: M::PeerId, message_id: M::MessageId, ) -> Pin<Box<dyn Future<Output = Result<(), BackendError<M>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn get_pending_outbound<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<M>, BackendError<M>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn get_pending_inbound<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<M>, BackendError<M>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn store_value<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, key: &'life1 str, value: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = Result<(), BackendError<M>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn load_value<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, BackendError<M>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

impl<M: MessageMetadata, T: Backend<M> + ?Sized> Backend<M> for Box<T>

Source§

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

Source§

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

Source§

fn clear_message_inbound<'life0, 'async_trait>( &'life0 self, peer_id: M::PeerId, message_id: M::MessageId, ) -> Pin<Box<dyn Future<Output = Result<(), BackendError<M>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn clear_message_outbound<'life0, 'async_trait>( &'life0 self, peer_id: M::PeerId, message_id: M::MessageId, ) -> Pin<Box<dyn Future<Output = Result<(), BackendError<M>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn get_pending_outbound<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<M>, BackendError<M>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn get_pending_inbound<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<M>, BackendError<M>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn store_value<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, key: &'life1 str, value: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = Result<(), BackendError<M>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn load_value<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, BackendError<M>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

impl<M: MessageMetadata, T: Backend<M> + ?Sized> Backend<M> for Arc<T>

Source§

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

Source§

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

Source§

fn clear_message_inbound<'life0, 'async_trait>( &'life0 self, peer_id: M::PeerId, message_id: M::MessageId, ) -> Pin<Box<dyn Future<Output = Result<(), BackendError<M>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn clear_message_outbound<'life0, 'async_trait>( &'life0 self, peer_id: M::PeerId, message_id: M::MessageId, ) -> Pin<Box<dyn Future<Output = Result<(), BackendError<M>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn get_pending_outbound<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<M>, BackendError<M>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn get_pending_inbound<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<M>, BackendError<M>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn store_value<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, key: &'life1 str, value: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = Result<(), BackendError<M>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn load_value<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, BackendError<M>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§