diff options
| author | 2025-01-07 03:43:43 -0600 | |
|---|---|---|
| committer | 2025-01-07 03:43:43 -0600 | |
| commit | 5d68d164d9a7bff8f3015257f25eb71c44829ddf (patch) | |
| tree | c6fa8bd5e7c4dc4e14268f3c34138b5bf92d3746 /src/launcher/download.rs | |
| parent | idr what I changed (diff) | |
untested moment (remove reqwest)
Diffstat (limited to 'src/launcher/download.rs')
| -rw-r--r-- | src/launcher/download.rs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/launcher/download.rs b/src/launcher/download.rs new file mode 100644 index 0000000..4294d33 --- /dev/null +++ b/src/launcher/download.rs @@ -0,0 +1,36 @@ +use std::path::{Path, PathBuf}; +use sha1_smol::Digest; + +pub trait Download { + fn get_url(&self) -> &str; + fn get_path(&self) -> &Path; + fn get_expect_digest(&self) -> Option<Digest>; + fn get_expect_size(&self) -> Option<usize>; + + fn always_redownload(&self) -> bool; +} + +pub type DownloadJob = dyn Download + Sync + Send; + +pub struct MultiDownloader<'j, 'js> { + jobs: &'js [&'j DownloadJob], + nhandles: usize +} + +impl<'j, 'js> MultiDownloader<'j, 'js> { + pub fn new(jobs: &'js [&'j DownloadJob]) -> MultiDownloader<'j, 'js> { + Self::with_handles(jobs, 8) + } + + pub fn with_handles(jobs: &'js [&'j DownloadJob], nhandles: usize) -> MultiDownloader<'j, 'js> { + assert!(nhandles > 0); + + MultiDownloader { + jobs, nhandles + } + } + + fn do_it(&self) { + + } +}
\ No newline at end of file |
