pub struct LightClientProtocol {
pub shared: Arc<SyncShared>,
}Expand description
Light client protocol handler.
Fields
Sync shared state.
Implementations
sourceimpl LightClientProtocol
impl LightClientProtocol
sourcepub fn new(shared: Arc<SyncShared>) -> Self
pub fn new(shared: Arc<SyncShared>) -> Self
Create a new light client protocol handler.
Trait Implementations
sourceimpl CKBProtocolHandler for LightClientProtocol
impl CKBProtocolHandler for LightClientProtocol
sourcefn 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 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,
Init action on service run
sourcefn connected<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_nc: Arc<dyn CKBProtocolContext + Sync>,
peer: PeerIndex,
version: &'life1 str
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn connected<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_nc: Arc<dyn CKBProtocolContext + Sync>,
peer: PeerIndex,
version: &'life1 str
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Called when opening protocol
sourcefn disconnected<'life0, 'async_trait>(
&'life0 mut self,
_nc: Arc<dyn CKBProtocolContext + Sync>,
peer: PeerIndex
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn disconnected<'life0, 'async_trait>(
&'life0 mut self,
_nc: Arc<dyn CKBProtocolContext + Sync>,
peer: PeerIndex
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Called when closing protocol
sourcefn received<'life0, 'async_trait>(
&'life0 mut self,
nc: Arc<dyn CKBProtocolContext + Sync>,
peer: PeerIndex,
data: Bytes
) -> 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: PeerIndex,
data: Bytes
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Called when the corresponding protocol message is received
Auto Trait Implementations
impl !RefUnwindSafe for LightClientProtocol
impl Send for LightClientProtocol
impl Sync for LightClientProtocol
impl Unpin for LightClientProtocol
impl !UnwindSafe for LightClientProtocol
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more