pub trait HeaderDownloader:
Send
+ Sync
+ Stream<Item = HeadersDownloaderResult<Vec<SealedHeader<Self::Header>>, Self::Header>>
+ Unpin {
type Header: Send + Sync + Unpin + 'static;
// Required methods
fn update_local_head(&mut self, head: SealedHeader<Self::Header>);
fn update_sync_target(&mut self, target: SyncTarget);
fn set_batch_size(&mut self, limit: usize);
// Provided method
fn update_sync_gap(
&mut self,
head: SealedHeader<Self::Header>,
target: SyncTarget,
) { ... }
}
Expand description
A downloader capable of fetching and yielding block headers.
A downloader represents a distinct strategy for submitting requests to download block headers,
while a HeadersClient
represents a client capable
of fulfilling these requests.
A HeaderDownloader
is a [Stream] that returns batches of headers.
Required Associated Types§
Required Methods§
Sourcefn update_local_head(&mut self, head: SealedHeader<Self::Header>)
fn update_local_head(&mut self, head: SealedHeader<Self::Header>)
Updates the block number of the local database
Sourcefn update_sync_target(&mut self, target: SyncTarget)
fn update_sync_target(&mut self, target: SyncTarget)
Updates the target we want to sync to
Sourcefn set_batch_size(&mut self, limit: usize)
fn set_batch_size(&mut self, limit: usize)
Sets the headers batch size that the Stream should return.
Provided Methods§
Sourcefn update_sync_gap(
&mut self,
head: SealedHeader<Self::Header>,
target: SyncTarget,
)
fn update_sync_gap( &mut self, head: SealedHeader<Self::Header>, target: SyncTarget, )
Updates the gap to sync which ranges from local head to the sync target
See also HeaderDownloader::update_sync_target
and
HeaderDownloader::update_local_head
Implementors§
Source§impl HeaderDownloader for TestHeaderDownloader
Available on crate feature test-utils
only.
impl HeaderDownloader for TestHeaderDownloader
Available on crate feature
test-utils
only.