Struct sc_network_sync::service::chain_sync::SyncingService
source · pub struct SyncingService<B: BlockT> { /* private fields */ }
Expand description
Handle for communicating with ChainSync
asynchronously
Implementations§
source§impl<B: BlockT> SyncingService<B>
impl<B: BlockT> SyncingService<B>
sourcepub fn new(
tx: TracingUnboundedSender<ToServiceCommand<B>>,
num_connected: Arc<AtomicUsize>,
is_major_syncing: Arc<AtomicBool>
) -> Self
pub fn new( tx: TracingUnboundedSender<ToServiceCommand<B>>, num_connected: Arc<AtomicUsize>, is_major_syncing: Arc<AtomicBool> ) -> Self
Create new handle
sourcepub async fn num_active_peers(&self) -> Result<usize, Canceled>
pub async fn num_active_peers(&self) -> Result<usize, Canceled>
Get the number of active peers.
sourcepub async fn best_seen_block(&self) -> Result<Option<NumberFor<B>>, Canceled>
pub async fn best_seen_block(&self) -> Result<Option<NumberFor<B>>, Canceled>
Get best seen block.
sourcepub async fn num_sync_peers(&self) -> Result<u32, Canceled>
pub async fn num_sync_peers(&self) -> Result<u32, Canceled>
Get the number of sync peers.
sourcepub async fn num_queued_blocks(&self) -> Result<u32, Canceled>
pub async fn num_queued_blocks(&self) -> Result<u32, Canceled>
Get the number of queued blocks.
sourcepub async fn num_downloaded_blocks(&self) -> Result<usize, Canceled>
pub async fn num_downloaded_blocks(&self) -> Result<usize, Canceled>
Get the number of downloaded blocks.
sourcepub async fn num_sync_requests(&self) -> Result<usize, Canceled>
pub async fn num_sync_requests(&self) -> Result<usize, Canceled>
Get the number of sync requests.
sourcepub async fn peers_info(
&self
) -> Result<Vec<(PeerId, ExtendedPeerInfo<B>)>, Canceled>
pub async fn peers_info( &self ) -> Result<Vec<(PeerId, ExtendedPeerInfo<B>)>, Canceled>
Get peer information.
sourcepub fn on_block_finalized(&self, hash: B::Hash, header: B::Header)
pub fn on_block_finalized(&self, hash: B::Hash, header: B::Header)
Notify the SyncingEngine
that a block has been finalized.
sourcepub async fn status(&self) -> Result<SyncStatus<B>, ()>
pub async fn status(&self) -> Result<SyncStatus<B>, ()>
Get sync status
Returns an error if ChainSync
has terminated.
Trait Implementations§
source§impl<B: Clone + BlockT> Clone for SyncingService<B>
impl<B: Clone + BlockT> Clone for SyncingService<B>
source§fn clone(&self) -> SyncingService<B>
fn clone(&self) -> SyncingService<B>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<B: BlockT> JustificationSyncLink<B> for SyncingService<B>
impl<B: BlockT> JustificationSyncLink<B> for SyncingService<B>
source§fn request_justification(&self, hash: &B::Hash, number: NumberFor<B>)
fn request_justification(&self, hash: &B::Hash, number: NumberFor<B>)
Request a justification for the given block from the network.
On success, the justification will be passed to the import queue that was part at initialization as part of the configuration.
source§fn clear_justification_requests(&self)
fn clear_justification_requests(&self)
source§impl<B: BlockT> Link<B> for SyncingService<B>
impl<B: BlockT> Link<B> for SyncingService<B>
source§fn blocks_processed(
&mut self,
imported: usize,
count: usize,
results: Vec<(Result<BlockImportStatus<NumberFor<B>>, BlockImportError>, B::Hash)>
)
fn blocks_processed( &mut self, imported: usize, count: usize, results: Vec<(Result<BlockImportStatus<NumberFor<B>>, BlockImportError>, B::Hash)> )
source§fn justification_imported(
&mut self,
who: PeerId,
hash: &B::Hash,
number: NumberFor<B>,
success: bool
)
fn justification_imported( &mut self, who: PeerId, hash: &B::Hash, number: NumberFor<B>, success: bool )
source§fn request_justification(&mut self, hash: &B::Hash, number: NumberFor<B>)
fn request_justification(&mut self, hash: &B::Hash, number: NumberFor<B>)
source§impl<B: BlockT> NetworkBlock<<B as Block>::Hash, <<B as Block>::Header as Header>::Number> for SyncingService<B>
impl<B: BlockT> NetworkBlock<<B as Block>::Hash, <<B as Block>::Header as Header>::Number> for SyncingService<B>
source§impl<B: BlockT + 'static> NetworkSyncForkRequest<<B as Block>::Hash, <<B as Block>::Header as Header>::Number> for SyncingService<B>
impl<B: BlockT + 'static> NetworkSyncForkRequest<<B as Block>::Hash, <<B as Block>::Header as Header>::Number> for SyncingService<B>
source§fn set_sync_fork_request(
&self,
peers: Vec<PeerId>,
hash: B::Hash,
number: NumberFor<B>
)
fn set_sync_fork_request( &self, peers: Vec<PeerId>, hash: B::Hash, number: NumberFor<B> )
Configure an explicit fork sync request.
Note that this function should not be used for recent blocks.
Sync should be able to download all the recent forks normally.
set_sync_fork_request
should only be used if external code detects that there’s
a stale fork missing.
Passing empty peers
set effectively removes the sync request.
source§impl<B: BlockT> SyncEventStream for SyncingService<B>
impl<B: BlockT> SyncEventStream for SyncingService<B>
source§impl<B: BlockT> SyncOracle for SyncingService<B>
impl<B: BlockT> SyncOracle for SyncingService<B>
source§fn is_major_syncing(&self) -> bool
fn is_major_syncing(&self) -> bool
source§fn is_offline(&self) -> bool
fn is_offline(&self) -> bool
source§impl<B: BlockT> SyncStatusProvider<B> for SyncingService<B>
impl<B: BlockT> SyncStatusProvider<B> for SyncingService<B>
Auto Trait Implementations§
impl<B> !RefUnwindSafe for SyncingService<B>
impl<B> Send for SyncingService<B>
impl<B> Sync for SyncingService<B>
impl<B> Unpin for SyncingService<B>
impl<B> !UnwindSafe for SyncingService<B>
Blanket Implementations§
source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T, Outer> IsWrappedBy<Outer> for Twhere
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for Twhere Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere Self: UniqueSaturatedFrom<T>,
source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere Self: UniqueSaturatedInto<T>,
T
. Read moresource§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere T: UncheckedFrom<S>,
source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from
.source§impl<T, S> UniqueSaturatedInto<T> for Swhere
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for Swhere T: Bounded, S: TryInto<T>,
source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.