Skip to content

Commit

Permalink
prepare release manager
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDavenport committed Apr 14, 2024
1 parent 1ee485a commit 1eed3d2
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 10 deletions.
1 change: 0 additions & 1 deletion gamercade_app/src/modes/arcade_mode/edit_game.rs

This file was deleted.

2 changes: 0 additions & 2 deletions gamercade_app/src/modes/arcade_mode/mod.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
use crate::app::AppDrawContext;

mod creator_dashboard;
mod edit_game;
mod login;
mod online;
mod sign_up;

use creator_dashboard::*;
use edit_game::*;
use login::*;
use online::*;
use sign_up::*;
Expand Down
9 changes: 3 additions & 6 deletions gamercade_app/src/task_manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ pub use super_task_manager::*;
mod auth;
pub use auth::*;

mod release;
pub use release::*;

const SUPER_TASK_CHANNEL_SIZE: usize = 256;
const TASK_CHANNEL_LENGTH: usize = 8;

Expand All @@ -38,12 +41,6 @@ where
}
}

pub fn send_request(&self, request: REQUEST) {
if let Err(e) = self.sender.try_send(request) {
panic!("send_request failed {e}")
}
}

fn spawn_task(
notification_tx: Sender<TaskNotification>,
state: Arc<Mutex<STATE>>,
Expand Down
23 changes: 23 additions & 0 deletions gamercade_app/src/task_manager/release.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use super::{TaskManager, TaskRequest};

// TODO: This
pub type ReleaseManager = TaskManager<ReleaseManagerState, ReleaseRequest>;

#[derive(Default)]
pub struct ReleaseManagerState {
downloads: Vec<usize>,
}

pub enum ReleaseRequest {
DownloadRelease,
}

impl TaskRequest<ReleaseManagerState> for ReleaseRequest {
async fn handle_request(
self,
sender: &tokio::sync::mpsc::Sender<super::TaskNotification>,
state: &tokio::sync::Mutex<ReleaseManagerState>,
) {
todo!()
}
}
6 changes: 5 additions & 1 deletion gamercade_app/src/task_manager/super_task_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ use tokio::sync::mpsc::{channel, Receiver};

use crate::local_directory::{PermissionLevel, PermissionLevelId, Tag, TagId};

use super::{AuthManager, AuthState, AuthorManager, TagManager, SUPER_TASK_CHANNEL_SIZE};
use super::{
AuthManager, AuthState, AuthorManager, ReleaseManager, TagManager, SUPER_TASK_CHANNEL_SIZE,
};

#[derive(Debug)]
pub enum TaskNotification {
Expand All @@ -17,6 +19,7 @@ pub struct SuperTaskManager {
pub tags: TagManager,
pub author: AuthorManager,
pub auth: AuthManager,
pub release: ReleaseManager,
}

impl Default for SuperTaskManager {
Expand All @@ -27,6 +30,7 @@ impl Default for SuperTaskManager {
tags: TagManager::new(event_tx.clone()),
author: AuthorManager::new(event_tx.clone()),
auth: AuthManager::new(event_tx.clone()),
release: ReleaseManager::new(event_tx.clone()),
events,
}
}
Expand Down

0 comments on commit 1eed3d2

Please sign in to comment.