Trait BodyDownloader
pub trait BodyDownloader:
Send
+ Sync
+ Stream<Item = Result<Vec<BlockResponse<Self::Block>>, DownloadError>>
+ Unpin {
type Block: Block + 'static;
// Required method
fn set_download_range(
&mut self,
range: RangeInclusive<u64>,
) -> Result<(), DownloadError>;
}
Available on crate feature
network
only.Expand description
A downloader capable of fetching and yielding block bodies from block headers.
A downloader represents a distinct strategy for submitting requests to download block bodies,
while a BodiesClient
represents a client capable of
fulfilling these requests.
Required Associated Types§
Required Methods§
fn set_download_range(
&mut self,
range: RangeInclusive<u64>,
) -> Result<(), DownloadError>
fn set_download_range( &mut self, range: RangeInclusive<u64>, ) -> Result<(), DownloadError>
Method for setting the download range.
Implementations on Foreign Types§
§impl<B> BodyDownloader for NoopBodiesDownloader<B>where
B: Block + 'static,
impl<B> BodyDownloader for NoopBodiesDownloader<B>where
B: Block + 'static,
type Block = B
fn set_download_range( &mut self, _: RangeInclusive<u64>, ) -> Result<(), DownloadError>
§impl<B> BodyDownloader for TaskDownloader<B>where
B: Block + 'static,
impl<B> BodyDownloader for TaskDownloader<B>where
B: Block + 'static,
type Block = B
fn set_download_range( &mut self, range: RangeInclusive<u64>, ) -> Result<(), DownloadError>
§impl<B, C, Provider> BodyDownloader for BodiesDownloader<B, C, Provider>where
B: Block + 'static,
C: BodiesClient<Body = <B as Block>::Body> + 'static,
Provider: HeaderProvider<Header = <B as Block>::Header> + Unpin + 'static,
impl<B, C, Provider> BodyDownloader for BodiesDownloader<B, C, Provider>where
B: Block + 'static,
C: BodiesClient<Body = <B as Block>::Body> + 'static,
Provider: HeaderProvider<Header = <B as Block>::Header> + Unpin + 'static,
§fn set_download_range(
&mut self,
range: RangeInclusive<u64>,
) -> Result<(), DownloadError>
fn set_download_range( &mut self, range: RangeInclusive<u64>, ) -> Result<(), DownloadError>
Set a new download range (exclusive).
This method will drain all queued bodies, filter out ones outside the range and put them back into the buffer. If there are any bodies between the range start and last queued body that have not been downloaded or are not in progress, they will be re-requested.