mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2025-11-10 04:22:13 +10:00
Revert "refactor(download manager): Moved manifest and stored_manifest to download_manager"
This reverts commit 8db2393346.
This commit is contained in:
@ -4,7 +4,4 @@ pub mod progress_object;
|
||||
pub mod queue;
|
||||
pub mod download_thread_control_flag;
|
||||
pub mod downloadable;
|
||||
pub mod application_download_error;
|
||||
pub mod download_logic;
|
||||
pub mod manifest;
|
||||
pub mod stored_manifest;
|
||||
pub mod application_download_error;
|
||||
@ -1,13 +1,11 @@
|
||||
use crate::auth::generate_authorization_header;
|
||||
use crate::db::DatabaseImpls;
|
||||
use crate::download_manager::application_download_error::ApplicationDownloadError;
|
||||
use crate::download_manager::download_logic::download_game_chunk;
|
||||
use crate::download_manager::download_manager::DownloadManagerSignal;
|
||||
use crate::download_manager::download_thread_control_flag::{DownloadThreadControl, DownloadThreadControlFlag};
|
||||
use crate::download_manager::downloadable::Downloadable;
|
||||
use crate::download_manager::manifest::{DropDownloadContext, DropManifest};
|
||||
use crate::download_manager::progress_object::{ProgressHandle, ProgressObject};
|
||||
use crate::download_manager::stored_manifest::StoredManifest;
|
||||
use crate::downloads::manifest::{DropDownloadContext, DropManifest};
|
||||
use crate::remote::RemoteAccessError;
|
||||
use crate::DB;
|
||||
use log::{debug, error, info};
|
||||
@ -23,17 +21,19 @@ use urlencoding::encode;
|
||||
#[cfg(target_os = "linux")]
|
||||
use rustix::fs::{fallocate, FallocateFlags};
|
||||
|
||||
use super::download_logic::download_game_chunk;
|
||||
use super::stored_manifest::StoredManifest;
|
||||
|
||||
pub struct GameDownloadAgent {
|
||||
id: String,
|
||||
version: String,
|
||||
control_flag: DownloadThreadControl,
|
||||
pub id: String,
|
||||
pub version: String,
|
||||
pub control_flag: DownloadThreadControl,
|
||||
contexts: Vec<DropDownloadContext>,
|
||||
completed_contexts: VecDeque<usize>,
|
||||
manifest: Mutex<Option<DropManifest>>,
|
||||
progress: Arc<ProgressObject>,
|
||||
pub manifest: Mutex<Option<DropManifest>>,
|
||||
pub progress: Arc<ProgressObject>,
|
||||
sender: Sender<DownloadManagerSignal>,
|
||||
stored_manifest: StoredManifest,
|
||||
pub stored_manifest: StoredManifest,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ use crate::db::DatabaseImpls;
|
||||
use crate::download_manager::application_download_error::ApplicationDownloadError;
|
||||
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;
|
||||
use http::StatusCode;
|
||||
@ -21,8 +22,6 @@ use std::{
|
||||
};
|
||||
use urlencoding::encode;
|
||||
|
||||
use super::manifest::DropDownloadContext;
|
||||
|
||||
pub struct DropWriter<W: Write> {
|
||||
hasher: Context,
|
||||
destination: W,
|
||||
@ -1,2 +1,5 @@
|
||||
pub mod download_agent;
|
||||
pub mod download_commands;
|
||||
mod download_logic;
|
||||
mod manifest;
|
||||
mod stored_manifest;
|
||||
|
||||
8
src-tauri/src/tools/external_component.rs
Normal file
8
src-tauri/src/tools/external_component.rs
Normal file
@ -0,0 +1,8 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
pub trait ExternalComponent {
|
||||
fn download(&mut self);
|
||||
fn version(&self) -> &String;
|
||||
fn is_installed(&self) -> bool;
|
||||
fn location(&self) -> &Option<PathBuf>;
|
||||
}
|
||||
@ -1,3 +1,4 @@
|
||||
mod external_component;
|
||||
mod prefix;
|
||||
mod registry;
|
||||
mod tool;
|
||||
@ -1,8 +1,7 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::download_manager::downloadable::Downloadable;
|
||||
use super::external_component::ExternalComponent;
|
||||
|
||||
|
||||
pub struct Registry<T: Downloadable> {
|
||||
pub struct Registry<T: ExternalComponent> {
|
||||
tools: HashMap<String, T>
|
||||
}
|
||||
|
||||
@ -1,42 +1,26 @@
|
||||
use std::{path::PathBuf, sync::Arc};
|
||||
use std::path::PathBuf;
|
||||
|
||||
use rustix::path::Arg;
|
||||
use super::external_component::ExternalComponent;
|
||||
|
||||
use crate::download_manager::{download_thread_control_flag::DownloadThreadControl, downloadable::Downloadable, progress_object::ProgressObject};
|
||||
|
||||
pub struct ToolDownloader {
|
||||
id: String,
|
||||
pub struct Tool {
|
||||
name: String,
|
||||
version: String,
|
||||
location: Option<PathBuf>,
|
||||
progress: Arc<ProgressObject>,
|
||||
control_flag: DownloadThreadControl
|
||||
}
|
||||
impl Downloadable for ToolDownloader {
|
||||
fn get_progress_object(&self) -> std::sync::Arc<crate::download_manager::progress_object::ProgressObject> {
|
||||
impl ExternalComponent for Tool {
|
||||
fn download(&mut self) {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn version(&self) -> String {
|
||||
self.version.clone()
|
||||
fn version(&self) -> &String {
|
||||
&self.version
|
||||
}
|
||||
|
||||
fn id(&self) -> String {
|
||||
self.id.clone()
|
||||
fn is_installed(&self) -> bool {
|
||||
self.location.is_some()
|
||||
}
|
||||
|
||||
fn download(&mut self) -> Result<(), crate::download_manager::application_download_error::ApplicationDownloadError> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn progress(&self) -> Arc<ProgressObject> {
|
||||
self.progress.clone()
|
||||
}
|
||||
|
||||
fn control_flag(&self) -> DownloadThreadControl {
|
||||
self.control_flag.clone()
|
||||
}
|
||||
|
||||
fn install_dir(&self) -> String {
|
||||
self.location.clone().unwrap().to_string_lossy().to_string()
|
||||
fn location(&self) -> &Option<PathBuf> {
|
||||
&self.location
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user