BodyDownloader

Trait BodyDownloader 

Source
pub trait BodyDownloader:
    Send
    + 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§

Source

type Block: Block + 'static

The Block type this downloader supports

Required Methods§

Source

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 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,

§

fn set_download_range( &mut self, range: RangeInclusive<u64>, ) -> Result<(), DownloadError>

Set a new download range (inclusive).

If the provided range is a suffix of the current range with the same end block, the existing download already covers it and the call is a no-op. If the range starts immediately after the current range, it is treated as the next consecutive range and appended without resetting the in-flight state. For all other ranges, the downloader state is cleared and the new range replaces the old one.

§

type Block = B

Implementors§