mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2026-07-27 10:14:48 +10:00
refactor(download manager): Moved download manager to separate directory
Signed-off-by: quexeky <git@quexeky.dev>
This commit is contained in:
+3
-6
@@ -12,12 +12,9 @@ use std::{
|
|||||||
use log::info;
|
use log::info;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
use super::{
|
use crate::downloads::download_agent::{GameDownloadAgent, GameDownloadError};
|
||||||
download_agent::{GameDownloadAgent, GameDownloadError},
|
|
||||||
download_manager_builder::CurrentProgressObject,
|
use super::{download_manager_builder::CurrentProgressObject, progress_object::ProgressObject, queue::Queue};
|
||||||
progress_object::ProgressObject,
|
|
||||||
queue::Queue,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub enum DownloadManagerSignal {
|
pub enum DownloadManagerSignal {
|
||||||
/// Resumes (or starts) the DownloadManager
|
/// Resumes (or starts) the DownloadManager
|
||||||
+3
-15
@@ -12,25 +12,13 @@ use log::{error, info};
|
|||||||
use tauri::{AppHandle, Emitter};
|
use tauri::{AppHandle, Emitter};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
db::{Database, GameStatus, GameTransientStatus},
|
db::{Database, GameStatus, GameTransientStatus}, download_manager::download_manager::GameDownloadStatus, downloads::download_agent::{GameDownloadAgent, GameDownloadError}, library::{
|
||||||
library::{
|
|
||||||
on_game_complete, push_game_update, QueueUpdateEvent,
|
on_game_complete, push_game_update, QueueUpdateEvent,
|
||||||
QueueUpdateEventQueueData, StatsUpdateEvent,
|
QueueUpdateEventQueueData, StatsUpdateEvent,
|
||||||
},
|
}, state::GameStatusManager, DB
|
||||||
state::GameStatusManager,
|
|
||||||
DB,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{
|
use super::{download_manager::{DownloadManager, DownloadManagerSignal, DownloadManagerStatus, GameDownloadAgentQueueStandin}, download_thread_control_flag::{DownloadThreadControl, DownloadThreadControlFlag}, progress_object::ProgressObject, queue::Queue};
|
||||||
download_agent::{GameDownloadAgent, GameDownloadError},
|
|
||||||
download_manager::{
|
|
||||||
DownloadManager, DownloadManagerSignal, DownloadManagerStatus,
|
|
||||||
GameDownloadAgentQueueStandin, GameDownloadStatus,
|
|
||||||
},
|
|
||||||
download_thread_control_flag::{DownloadThreadControl, DownloadThreadControlFlag},
|
|
||||||
progress_object::ProgressObject,
|
|
||||||
queue::Queue,
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@@ -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;
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
use crate::auth::generate_authorization_header;
|
use crate::auth::generate_authorization_header;
|
||||||
use crate::db::DatabaseImpls;
|
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::manifest::{DropDownloadContext, DropManifest};
|
||||||
use crate::downloads::progress_object::ProgressHandle;
|
|
||||||
use crate::remote::RemoteAccessError;
|
use crate::remote::RemoteAccessError;
|
||||||
use crate::DB;
|
use crate::DB;
|
||||||
use log::{debug, error, info};
|
use log::{debug, error, info};
|
||||||
@@ -20,9 +22,6 @@ use urlencoding::encode;
|
|||||||
use rustix::fs::{fallocate, FallocateFlags};
|
use rustix::fs::{fallocate, FallocateFlags};
|
||||||
|
|
||||||
use super::download_logic::download_game_chunk;
|
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;
|
use super::stored_manifest::StoredManifest;
|
||||||
|
|
||||||
pub struct GameDownloadAgent {
|
pub struct GameDownloadAgent {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
use crate::auth::generate_authorization_header;
|
use crate::auth::generate_authorization_header;
|
||||||
use crate::db::DatabaseImpls;
|
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::downloads::manifest::DropDownloadContext;
|
||||||
use crate::remote::RemoteAccessError;
|
use crate::remote::RemoteAccessError;
|
||||||
use crate::DB;
|
use crate::DB;
|
||||||
@@ -19,8 +21,6 @@ use std::{
|
|||||||
use urlencoding::encode;
|
use urlencoding::encode;
|
||||||
|
|
||||||
use super::download_agent::GameDownloadError;
|
use super::download_agent::GameDownloadError;
|
||||||
use super::download_thread_control_flag::{DownloadThreadControl, DownloadThreadControlFlag};
|
|
||||||
use super::progress_object::ProgressHandle;
|
|
||||||
|
|
||||||
pub struct DropWriter<W: Write> {
|
pub struct DropWriter<W: Write> {
|
||||||
hasher: Context,
|
hasher: Context,
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
pub mod download_agent;
|
pub mod download_agent;
|
||||||
pub mod download_commands;
|
pub mod download_commands;
|
||||||
mod download_logic;
|
mod download_logic;
|
||||||
pub mod download_manager;
|
|
||||||
pub mod download_manager_builder;
|
|
||||||
mod download_thread_control_flag;
|
|
||||||
mod manifest;
|
mod manifest;
|
||||||
mod progress_object;
|
|
||||||
pub mod queue;
|
|
||||||
mod stored_manifest;
|
mod stored_manifest;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ mod process;
|
|||||||
mod remote;
|
mod remote;
|
||||||
mod state;
|
mod state;
|
||||||
mod tools;
|
mod tools;
|
||||||
|
pub mod download_manager;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
@@ -18,9 +19,9 @@ use db::{
|
|||||||
add_download_dir, delete_download_dir, fetch_download_dir_stats, DatabaseInterface, GameStatus,
|
add_download_dir, delete_download_dir, fetch_download_dir_stats, DatabaseInterface, GameStatus,
|
||||||
DATA_ROOT_DIR,
|
DATA_ROOT_DIR,
|
||||||
};
|
};
|
||||||
|
use download_manager::download_manager::DownloadManager;
|
||||||
|
use download_manager::download_manager_builder::DownloadManagerBuilder;
|
||||||
use downloads::download_commands::*;
|
use downloads::download_commands::*;
|
||||||
use downloads::download_manager::DownloadManager;
|
|
||||||
use downloads::download_manager_builder::DownloadManagerBuilder;
|
|
||||||
use http::Response;
|
use http::Response;
|
||||||
use http::{header::*, response::Builder as ResponseBuilder};
|
use http::{header::*, response::Builder as ResponseBuilder};
|
||||||
use library::{
|
use library::{
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use urlencoding::encode;
|
|||||||
use crate::db::DatabaseImpls;
|
use crate::db::DatabaseImpls;
|
||||||
use crate::db::GameVersion;
|
use crate::db::GameVersion;
|
||||||
use crate::db::GameStatus;
|
use crate::db::GameStatus;
|
||||||
use crate::downloads::download_manager::{DownloadManagerStatus, GameDownloadStatus};
|
use crate::download_manager::download_manager::{DownloadManagerStatus, GameDownloadStatus};
|
||||||
use crate::process::process_manager::Platform;
|
use crate::process::process_manager::Platform;
|
||||||
use crate::remote::RemoteAccessError;
|
use crate::remote::RemoteAccessError;
|
||||||
use crate::state::{GameStatusManager, GameStatusWithTransient};
|
use crate::state::{GameStatusManager, GameStatusWithTransient};
|
||||||
|
|||||||
Reference in New Issue
Block a user