Skip to content

Commit

Permalink
progress download state
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDavenport committed Apr 20, 2024
1 parent 4ca554e commit 68d06e8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/target
/keyboardInput.json
*.db
/roms
/roms
18 changes: 17 additions & 1 deletion gamercade_app/src/task_manager/rom.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use gamercade_interface::{Session, SESSION_METADATA_KEY};

use hashbrown::HashMap;
use tokio::{io::AsyncWriteExt, sync::mpsc::Sender};

use crate::{
Expand All @@ -14,7 +15,22 @@ use super::{TaskManager, TaskRequest};
pub type RomManager = TaskManager<RomManagerState, RomRequest>;

#[derive(Default)]
pub struct RomManagerState;
pub struct RomManagerState {
downloads: HashMap<i64, ActiveDownload>,
}

pub struct ActiveDownload {
id: i64,
download_status: DownloadStatus,
}

pub enum DownloadStatus {
InProgress {
bytes_downloaded: usize,
total_bytes: usize,
},
Done(Vec<u8>),
}

#[derive(Debug)]
pub enum RomRequest {
Expand Down

0 comments on commit 68d06e8

Please sign in to comment.