Struct ckb_sync::Synchronizer [−][src]
pub struct Synchronizer {
pub shared: Arc<SyncShared>,
// some fields omitted
}Expand description
Sync protocol handle
Fields
Sync shared state
Implementations
impl Synchronizer[src]
impl Synchronizer[src]pub fn new(chain: ChainController, shared: Arc<SyncShared>) -> Synchronizer[src]
pub fn new(chain: ChainController, shared: Arc<SyncShared>) -> Synchronizer[src]Init sync protocol handle
This is a runtime sync protocol shared state, and any relay messages will be processed and forwarded by it
pub fn shared(&self) -> &Arc<SyncShared>[src]
pub fn shared(&self) -> &Arc<SyncShared>[src]Get shared state
pub fn process_new_block(&self, block: BlockView) -> Result<bool, AnyError>[src]
pub fn process_new_block(&self, block: BlockView) -> Result<bool, AnyError>[src]Process a new block sync from other peer
pub fn get_blocks_to_fetch(
&self,
peer: PeerIndex,
ibd: IBDState
) -> Option<Vec<Vec<Byte32>>>[src]
pub fn get_blocks_to_fetch(
&self,
peer: PeerIndex,
ibd: IBDState
) -> Option<Vec<Vec<Byte32>>>[src]Get blocks to fetch
pub fn eviction(&self, nc: &dyn CKBProtocolContext)[src]
pub fn eviction(&self, nc: &dyn CKBProtocolContext)[src]Regularly check and eject some nodes that do not respond in time
Trait Implementations
impl CKBProtocolHandler for Synchronizer[src]
impl CKBProtocolHandler for Synchronizer[src]fn init(&mut self, nc: Arc<dyn CKBProtocolContext + Sync>)[src]
fn init(&mut self, nc: Arc<dyn CKBProtocolContext + Sync>)[src]Init action on service run
fn received(
&mut self,
nc: Arc<dyn CKBProtocolContext + Sync>,
peer_index: PeerIndex,
data: Bytes
)[src]
fn received(
&mut self,
nc: Arc<dyn CKBProtocolContext + Sync>,
peer_index: PeerIndex,
data: Bytes
)[src]Called when the corresponding protocol message is received
fn connected(
&mut self,
nc: Arc<dyn CKBProtocolContext + Sync>,
peer_index: PeerIndex,
_version: &str
)[src]
fn connected(
&mut self,
nc: Arc<dyn CKBProtocolContext + Sync>,
peer_index: PeerIndex,
_version: &str
)[src]Called when opening protocol
fn disconnected(
&mut self,
_nc: Arc<dyn CKBProtocolContext + Sync>,
peer_index: PeerIndex
)[src]
fn disconnected(
&mut self,
_nc: Arc<dyn CKBProtocolContext + Sync>,
peer_index: PeerIndex
)[src]Called when closing protocol
impl Clone for Synchronizer[src]
impl Clone for Synchronizer[src]fn clone(&self) -> Synchronizer[src]
fn clone(&self) -> Synchronizer[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]Performs copy-assignment from source. Read more
Auto Trait Implementations
impl !RefUnwindSafe for Synchronizer
impl Send for Synchronizer
impl Sync for Synchronizer
impl Unpin for Synchronizer
impl !UnwindSafe for Synchronizer
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for Timpl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, [src]type Owned = T
type Owned = TThe resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn to_owned(&self) -> T[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)[src]
pub fn clone_into(&self, target: &mut T)[src]🔬 This is a nightly-only experimental API. (toowned_clone_into)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,