Trait ckb_network::CKBProtocolHandler
source · 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§
Provided Methods§
sourcefn 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 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
sourcefn 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 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
sourcefn 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 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