CKBProtocolHandler

Trait CKBProtocolHandler 

Source
pub trait CKBProtocolHandler: Sync + Send {
    // Required method
    fn init<'life0, 'async_trait>(
        &'life0 mut self,
        nc: BoxedCKBProtocolContext,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn connected<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        _nc: BoxedCKBProtocolContext,
        _peer_index: PeerIndex,
        _version: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn disconnected<'life0, 'async_trait>(
        &'life0 mut self,
        _nc: BoxedCKBProtocolContext,
        _peer_index: PeerIndex,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn received<'life0, 'async_trait>(
        &'life0 mut self,
        _nc: BoxedCKBProtocolContext,
        _peer_index: PeerIndex,
        _data: Bytes,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn notify<'life0, 'async_trait>(
        &'life0 mut self,
        _nc: BoxedCKBProtocolContext,
        _token: u64,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn poll<'life0, 'async_trait>(
        &'life0 mut self,
        _nc: BoxedCKBProtocolContext,
    ) -> Pin<Box<dyn Future<Output = Option<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Abstract protocol handle base on tentacle service handle

Required Methods§

Source

fn init<'life0, 'async_trait>( &'life0 mut self, nc: BoxedCKBProtocolContext, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Init action on service run

Provided Methods§

Source

fn connected<'life0, 'life1, 'async_trait>( &'life0 mut self, _nc: BoxedCKBProtocolContext, _peer_index: PeerIndex, _version: &'life1 str, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Called when opening protocol

Source

fn disconnected<'life0, 'async_trait>( &'life0 mut self, _nc: BoxedCKBProtocolContext, _peer_index: PeerIndex, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when closing protocol

Source

fn received<'life0, 'async_trait>( &'life0 mut self, _nc: BoxedCKBProtocolContext, _peer_index: PeerIndex, _data: Bytes, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when the corresponding protocol message is received

Source

fn notify<'life0, 'async_trait>( &'life0 mut self, _nc: BoxedCKBProtocolContext, _token: u64, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when the Service receives the notify task

Source

fn poll<'life0, 'async_trait>( &'life0 mut self, _nc: BoxedCKBProtocolContext, ) -> Pin<Box<dyn Future<Output = Option<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Behave like Stream::poll

Implementors§