PubSubTopic

Trait PubSubTopic 

Source
pub trait PubSubTopic: Send + Sync {
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn publish<'life0, 'async_trait>(
        &'life0 self,
        message: Vec<u8>,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn peers<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<PeerId>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn watch_peers<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Event> + Send>>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn watch_messages<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = EventPubSubMessage> + Send>>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn topic(&self) -> &str;
}
Expand description

Representa a inscrição em um tópico pub/sub específico.

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

Required Methods§

Source

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

Publica uma nova mensagem no tópico.

Source

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

Lista os pares (peers) conectados a este tópico.

Source

fn watch_peers<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Event> + Send>>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Observa os pares que entram e saem do tópico.

Source

fn watch_messages<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = EventPubSubMessage> + Send>>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Observa as novas mensagens publicadas no tópico.

Source

fn topic(&self) -> &str

Retorna o nome do tópico.

Implementors§

Source§

impl PubSubTopic for IrohTopic

Source§

impl PubSubTopic for guardian_db::p2p::pubsub::raw::PsTopic

Source§

impl PubSubTopic for guardian_db::p2p::pubsub::PsTopic