refactor: Created file settings.rs

Add constant values here to have a central management point for any relevant constants

Signed-off-by: quexeky <git@quexeky.dev>
This commit is contained in:
quexeky
2024-11-11 09:11:46 +11:00
parent 4fc13a1c8f
commit b47b7ea935
3 changed files with 3 additions and 5 deletions

View File

@ -2,6 +2,7 @@ use crate::auth::generate_authorization_header;
use crate::db::DatabaseImpls; use crate::db::DatabaseImpls;
use crate::downloads::manifest::{DropDownloadContext, DropManifest}; use crate::downloads::manifest::{DropDownloadContext, DropManifest};
use crate::remote::RemoteAccessError; use crate::remote::RemoteAccessError;
use crate::settings::DOWNLOAD_MAX_THREADS;
use crate::DB; use crate::DB;
use log::info; use log::info;
use rayon::ThreadPoolBuilder; use rayon::ThreadPoolBuilder;
@ -24,7 +25,6 @@ pub struct GameDownloadAgent {
pub control_flag: Arc<RwLock<DownloadThreadControlFlag>>, pub control_flag: Arc<RwLock<DownloadThreadControlFlag>>,
pub target_download_dir: usize, pub target_download_dir: usize,
contexts: Mutex<Vec<DropDownloadContext>>, contexts: Mutex<Vec<DropDownloadContext>>,
// pub progress: ProgressChecker<DropDownloadContext>,
pub manifest: Mutex<Option<DropManifest>>, pub manifest: Mutex<Option<DropManifest>>,
pub progress: ProgressObject, pub progress: ProgressObject,
} }
@ -53,8 +53,6 @@ impl Display for GameDownloadError {
} }
} }
pub const DOWNLOAD_MAX_THREADS: usize = 4;
pub struct ProgressObject { pub struct ProgressObject {
pub max: u64, pub max: u64,
pub current: Arc<AtomicU64>, pub current: Arc<AtomicU64>,

View File

@ -4,6 +4,7 @@ mod downloads;
mod library; mod library;
mod p2p; mod p2p;
mod remote; mod remote;
mod settings;
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;
@ -26,8 +27,6 @@ use std::{
}; };
use tauri_plugin_deep_link::DeepLinkExt; use tauri_plugin_deep_link::DeepLinkExt;
pub const GAME_PAUSE_CHECK_INTERVAL: Duration = Duration::from_secs(1);
#[derive(Clone, Copy, Serialize)] #[derive(Clone, Copy, Serialize)]
pub enum AppStatus { pub enum AppStatus {
NotConfigured, NotConfigured,

View File

@ -0,0 +1 @@
pub const DOWNLOAD_MAX_THREADS: usize = 4;