pub trait CKBProtocolHandler: Sync + Send {
    fn init<'life0, 'async_trait>(
        &'life0 mut self,
        nc: Arc<dyn CKBProtocolContext + Sync>
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; 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
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: '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
        'life0: 'async_trait,
        Self: '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
        'life0: 'async_trait,
        Self: '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
        'life0: 'async_trait,
        Self: '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
        'life0: 'async_trait,
        Self: 'async_trait
, { ... } }
Expand description

Abstract protocol handle base on tentacle service handle

Required Methods

Init action on service run

Provided Methods

Called when opening protocol

Called when closing protocol

Called when the corresponding protocol message is received

Called when the Service receives the notify task

Behave like Stream::poll

Implementors