From 5d68d164d9a7bff8f3015257f25eb71c44829ddf Mon Sep 17 00:00:00 2001 From: bigfoot547 Date: Tue, 7 Jan 2025 03:43:43 -0600 Subject: untested moment (remove reqwest) --- src/launcher/download.rs | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/launcher/download.rs (limited to 'src/launcher/download.rs') 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; + fn get_expect_size(&self) -> Option; + + 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 -- cgit v1.2.3-70-g09d2