pub struct SyncingService<B: BlockT> { /* private fields */ }
Expand description
Handle for communicating with SyncingEngine
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 fn num_connected_peers(&self) -> usize
pub fn num_connected_peers(&self) -> usize
Get the number of peers known to SyncingEngine
(both full and light).
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 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>, Canceled>
pub async fn status(&self) -> Result<SyncStatus<B>, Canceled>
Get sync status
Returns an error if SyncingEngine
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> Freeze for SyncingService<B>
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<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
Source§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 S
impl<T, S> UniqueSaturatedInto<T> for S
Source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.