refactor(download manager): Moved download manager to separate directory

Signed-off-by: quexeky <git@quexeky.dev>
This commit is contained in:
quexeky
2024-12-30 17:25:17 +11:00
parent 3299c71b3d
commit b6c64e56e5
10 changed files with 19 additions and 34 deletions

View File

@ -12,12 +12,9 @@ use std::{
use log::info;
use serde::Serialize;
use super::{
download_agent::{GameDownloadAgent, GameDownloadError},
download_manager_builder::CurrentProgressObject,
progress_object::ProgressObject,
queue::Queue,
};
use crate::downloads::download_agent::{GameDownloadAgent, GameDownloadError};
use super::{download_manager_builder::CurrentProgressObject, progress_object::ProgressObject, queue::Queue};
pub enum DownloadManagerSignal {
/// Resumes (or starts) the DownloadManager

View File

@ -12,25 +12,13 @@ use log::{error, info};
use tauri::{AppHandle, Emitter};
use crate::{
db::{Database, GameStatus, GameTransientStatus},
library::{
db::{Database, GameStatus, GameTransientStatus}, download_manager::download_manager::GameDownloadStatus, downloads::download_agent::{GameDownloadAgent, GameDownloadError}, library::{
on_game_complete, push_game_update, QueueUpdateEvent,
QueueUpdateEventQueueData, StatsUpdateEvent,
},
state::GameStatusManager,
DB,
}, state::GameStatusManager, DB
};
use super::{
download_agent::{GameDownloadAgent, GameDownloadError},
download_manager::{
DownloadManager, DownloadManagerSignal, DownloadManagerStatus,
GameDownloadAgentQueueStandin, GameDownloadStatus,
},
download_thread_control_flag::{DownloadThreadControl, DownloadThreadControlFlag},
progress_object::ProgressObject,
queue::Queue,
};
use super::{download_manager::{DownloadManager, DownloadManagerSignal, DownloadManagerStatus, GameDownloadAgentQueueStandin}, download_thread_control_flag::{DownloadThreadControl, DownloadThreadControlFlag}, progress_object::ProgressObject, queue::Queue};
/*

View File

@ -0,0 +1,5 @@
pub mod download_manager;
pub mod download_manager_builder;
pub mod progress_object;
pub mod queue;
pub mod download_thread_control_flag;

View File

@ -1,7 +1,9 @@
use crate::auth::generate_authorization_header;
use crate::db::DatabaseImpls;
use crate::download_manager::download_manager::DownloadManagerSignal;
use crate::download_manager::download_thread_control_flag::{DownloadThreadControl, DownloadThreadControlFlag};
use crate::download_manager::progress_object::{ProgressHandle, ProgressObject};
use crate::downloads::manifest::{DropDownloadContext, DropManifest};
use crate::downloads::progress_object::ProgressHandle;
use crate::remote::RemoteAccessError;
use crate::DB;
use log::{debug, error, info};
@ -20,9 +22,6 @@ use urlencoding::encode;
use rustix::fs::{fallocate, FallocateFlags};
use super::download_logic::download_game_chunk;
use super::download_manager::DownloadManagerSignal;
use super::download_thread_control_flag::{DownloadThreadControl, DownloadThreadControlFlag};
use super::progress_object::ProgressObject;
use super::stored_manifest::StoredManifest;
pub struct GameDownloadAgent {

View File

@ -1,5 +1,7 @@
use crate::auth::generate_authorization_header;
use crate::db::DatabaseImpls;
use crate::download_manager::download_thread_control_flag::{DownloadThreadControl, DownloadThreadControlFlag};
use crate::download_manager::progress_object::ProgressHandle;
use crate::downloads::manifest::DropDownloadContext;
use crate::remote::RemoteAccessError;
use crate::DB;
@ -20,8 +22,6 @@ use std::{
use urlencoding::encode;
use super::download_agent::GameDownloadError;
use super::download_thread_control_flag::{DownloadThreadControl, DownloadThreadControlFlag};
use super::progress_object::ProgressHandle;
pub struct DropWriter<W: Write> {
hasher: Context,

View File

@ -1,10 +1,5 @@
pub mod download_agent;
pub mod download_commands;
mod download_logic;
pub mod download_manager;
pub mod download_manager_builder;
mod download_thread_control_flag;
mod manifest;
mod progress_object;
pub mod queue;
mod stored_manifest;

View File

@ -10,6 +10,7 @@ mod process;
mod remote;
mod state;
mod tools;
pub mod download_manager;
#[cfg(test)]
mod tests;
@ -24,10 +25,10 @@ use db::{
add_download_dir, delete_download_dir, fetch_download_dir_stats, DatabaseInterface, GameStatus,
DATA_ROOT_DIR,
};
use download_manager::download_manager::DownloadManager;
use download_manager::download_manager_builder::DownloadManagerBuilder;
use debug::fetch_system_data;
use downloads::download_commands::*;
use downloads::download_manager::DownloadManager;
use downloads::download_manager_builder::DownloadManagerBuilder;
use http::Response;
use http::{header::*, response::Builder as ResponseBuilder};
use library::{