Included in AppStatus (Also trying to link to Issue #1)

This commit is contained in:
quexeky
2024-10-19 14:54:29 +11:00
parent e71e4cf0fa
commit 27d0dcafc7
3 changed files with 14 additions and 4 deletions

View File

@ -1,15 +1,20 @@
use std::sync::Arc;
use std::sync::atomic::AtomicUsize;
use serde::{Deserialize, Serialize};
use versions::Version;
use crate::downloads::progress::ProgressChecker;
#[derive(Serialize, Deserialize, Clone)]
#[serde(rename_all="camelCase")]
pub struct GameDownload {
id: String,
version: Version,
progress: Arc<AtomicUsize>
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all="camelCase")]
pub struct GameChunkCtx {
chunk_id: usize,
}
impl GameDownload {
@ -22,9 +27,10 @@ impl GameDownload {
}
pub async fn download(&self, max_threads: usize, contexts: Vec<GameChunkCtx>) {
let progress = ProgressChecker::new(Box::new(download_game_chunk), self.progress.clone());
progress.run_contexts_sequentially_async(contexts).await;
progress.run_contexts_parallel_async(contexts, max_threads).await;
}
}
fn download_game_chunk(ctx: GameChunkCtx) {
todo!()
todo!();
// Need to implement actual download logic
}

View File

@ -1,4 +1,4 @@
mod downloads;
mod manifest;
pub mod progress;
mod game_download;
pub mod game_download;