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§
Provided Methods§
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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