refactor: Rename StoredManifest to DropData

Signed-off-by: quexeky <git@quexeky.dev>
This commit is contained in:
quexeky
2025-06-07 09:54:41 +10:00
parent 0ce55e12c5
commit ae04099daa
3 changed files with 10 additions and 10 deletions

View File

@ -27,7 +27,7 @@ use tauri::{AppHandle, Emitter};
use rustix::fs::{fallocate, FallocateFlags};
use super::download_logic::download_game_chunk;
use super::stored_manifest::StoredManifest;
use super::drop_data::DropData;
pub struct GameDownloadAgent {
pub id: String,
@ -38,7 +38,7 @@ pub struct GameDownloadAgent {
pub manifest: Mutex<Option<DropManifest>>,
pub progress: Arc<ProgressObject>,
sender: Sender<DownloadManagerSignal>,
pub stored_manifest: StoredManifest,
pub stored_manifest: DropData,
status: Mutex<DownloadStatus>,
}
@ -60,7 +60,7 @@ impl GameDownloadAgent {
let data_base_dir_path = base_dir_path.join(id.clone());
let stored_manifest =
StoredManifest::generate(id.clone(), version.clone(), data_base_dir_path.clone());
DropData::generate(id.clone(), version.clone(), data_base_dir_path.clone());
Self {
id,

View File

@ -10,7 +10,7 @@ use serde::{Deserialize, Serialize};
use serde_binary::binary_stream::Endian;
#[derive(Serialize, Deserialize, Debug)]
pub struct StoredManifest {
pub struct DropData {
game_id: String,
game_version: String,
pub completed_contexts: Mutex<Vec<usize>>,
@ -19,7 +19,7 @@ pub struct StoredManifest {
static DROP_DATA_PATH: &str = ".dropdata";
impl StoredManifest {
impl DropData {
pub fn new(game_id: String, game_version: String, base_path: PathBuf) -> Self {
Self {
base_path,
@ -31,7 +31,7 @@ impl StoredManifest {
pub fn generate(game_id: String, game_version: String, base_path: PathBuf) -> Self {
let mut file = match File::open(base_path.join(DROP_DATA_PATH)) {
Ok(file) => file,
Err(_) => return StoredManifest::new(game_id, game_version, base_path),
Err(_) => return DropData::new(game_id, game_version, base_path),
};
let mut s = Vec::new();
@ -39,15 +39,15 @@ impl StoredManifest {
Ok(_) => {}
Err(e) => {
error!("{}", e);
return StoredManifest::new(game_id, game_version, base_path);
return DropData::new(game_id, game_version, base_path);
}
};
match serde_binary::from_vec::<StoredManifest>(s, Endian::Little) {
match serde_binary::from_vec::<DropData>(s, Endian::Little) {
Ok(manifest) => manifest,
Err(e) => {
warn!("{}", e);
StoredManifest::new(game_id, game_version, base_path)
DropData::new(game_id, game_version, base_path)
}
}
}

View File

@ -2,4 +2,4 @@ pub mod commands;
pub mod download_agent;
mod download_logic;
mod manifest;
mod stored_manifest;
mod drop_data;