reth_stages/stages/s3/downloader/
mod.rs

1//! Provides functionality for downloading files in chunks from a remote source. It supports
2//! concurrent downloads, resuming interrupted downloads, and file integrity verification.
3
4mod error;
5mod fetch;
6mod meta;
7mod worker;
8
9pub(crate) use error::DownloaderError;
10pub use fetch::fetch;
11pub use meta::Metadata;
12
13/// Response sent by the fetch task to `S3Stage` once it has downloaded all files of a block
14/// range.
15pub(crate) enum S3DownloaderResponse {
16    /// A new block range was downloaded.
17    AddedNewRange,
18    /// The last requested block range was downloaded.
19    Done,
20}
21
22impl S3DownloaderResponse {
23    /// Whether the downloaded block range is the last requested one.
24    pub(crate) const fn is_done(&self) -> bool {
25        matches!(self, Self::Done)
26    }
27}
28
29/// Chunk nth remaining range to be downloaded.
30#[derive(Debug)]
31pub struct RemainingChunkRange {
32    /// The nth chunk
33    pub index: usize,
34    /// Start of range
35    pub start: usize,
36    /// End of range
37    pub end: usize,
38}