pub trait CKBProtocolHandler: Sync + Send {
    // Required method
    fn init<'life0, 'async_trait>(
        &'life0 mut self,
        nc: Arc<dyn CKBProtocolContext + Sync>
    ) -> 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: Arc<dyn CKBProtocolContext + Sync>,
        _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: Arc<dyn CKBProtocolContext + Sync>,
        _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: Arc<dyn CKBProtocolContext + Sync>,
        _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: Arc<dyn CKBProtocolContext + Sync>,
        _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: Arc<dyn CKBProtocolContext + Sync>
    ) -> 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: Arc<dyn CKBProtocolContext + Sync> ) -> 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: Arc<dyn CKBProtocolContext + Sync>, _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: Arc<dyn CKBProtocolContext + Sync>, _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: Arc<dyn CKBProtocolContext + Sync>, _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: Arc<dyn CKBProtocolContext + Sync>, _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: Arc<dyn CKBProtocolContext + Sync> ) -> Pin<Box<dyn Future<Output = Option<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Behave like Stream::poll

Implementors§