-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
139 additions
and
185 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
use crate::sd_path::SdPath; | ||
use serde::{Deserialize, Serialize}; | ||
use specta::Type; | ||
/// A single file copy operation, whether successful or failed | ||
#[derive(Debug, Serialize, Deserialize, Type, Clone)] | ||
pub struct CopyOperation { | ||
/// Source path of the file | ||
pub source: SdPath, | ||
/// Target path where the file was/should be copied to | ||
pub target: SdPath, | ||
/// Size of the file in bytes | ||
pub size: u64, | ||
/// Whether this was a cross-device copy | ||
pub cross_device: bool, | ||
/// Time taken for the copy in milliseconds (None if failed) | ||
pub duration_ms: Option<u64>, | ||
/// Error message if the copy failed (None if successful) | ||
pub error: Option<String>, | ||
} | ||
|
||
/// Statistics and results from a copy operation | ||
#[derive(Debug, Serialize, Deserialize, Type, Clone)] | ||
pub struct CopyStats { | ||
/// Total number of files to copy | ||
pub total_files: u32, | ||
/// Total bytes to copy | ||
pub total_bytes: u64, | ||
/// Number of files successfully copied | ||
pub completed_files: u32, | ||
/// Number of bytes successfully copied | ||
pub completed_bytes: u64, | ||
/// Average speed in bytes per second | ||
pub speed: u64, | ||
/// List of successful copy operations | ||
pub successful: Vec<CopyOperation>, | ||
/// List of failed copy operations | ||
pub failed: Vec<CopyOperation>, | ||
} | ||
|
||
impl Default for CopyStats { | ||
fn default() -> Self { | ||
Self { | ||
total_files: 0, | ||
total_bytes: 0, | ||
completed_files: 0, | ||
completed_bytes: 0, | ||
speed: 0, | ||
successful: Vec::new(), | ||
failed: Vec::new(), | ||
} | ||
} | ||
} | ||
|
||
impl CopyStats { | ||
pub fn files_skipped(&self) -> u32 { | ||
self.total_files - (self.completed_files + self.failed.len() as u32) | ||
} | ||
|
||
pub fn successful_operations(&self) -> impl Iterator<Item = &CopyOperation> { | ||
self.successful.iter() | ||
} | ||
|
||
pub fn failed_operations(&self) -> impl Iterator<Item = &CopyOperation> { | ||
self.failed.iter() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
pub mod copy; | ||
use crate::jobs::copy::CopyStats; | ||
use serde::{Deserialize, Serialize}; | ||
use serde_json; | ||
use specta::Type; | ||
use std::{collections::HashMap, path::PathBuf}; | ||
use uuid::Uuid; | ||
#[derive(Debug, Serialize, Deserialize, Type, Clone)] | ||
#[serde(rename_all = "snake_case")] | ||
#[serde(tag = "type", content = "data")] | ||
pub enum ReportOutputMetadata { | ||
Metrics(HashMap<String, serde_json::Value>), | ||
Indexer { | ||
total_paths: (u32, u32), | ||
}, | ||
FileIdentifier { | ||
total_orphan_paths: (u32, u32), | ||
total_objects_created: (u32, u32), | ||
total_objects_linked: (u32, u32), | ||
}, | ||
MediaProcessor { | ||
media_data_extracted: (u32, u32), | ||
media_data_skipped: (u32, u32), | ||
thumbnails_generated: (u32, u32), | ||
thumbnails_skipped: (u32, u32), | ||
}, | ||
Copier(CopyStats), | ||
Deleter { | ||
location_id: Uuid, | ||
file_path_ids: Vec<Uuid>, | ||
}, | ||
FileValidator { | ||
location_id: Uuid, | ||
sub_path: Option<PathBuf>, | ||
}, | ||
|
||
// DEPRECATED | ||
Mover { | ||
source_location_id: Uuid, | ||
target_location_id: Uuid, | ||
sources_file_path_ids: Vec<Uuid>, | ||
target_location_relative_directory_path: PathBuf, | ||
}, | ||
|
||
Eraser { | ||
location_id: Uuid, | ||
file_path_ids: Vec<Uuid>, | ||
passes: u32, | ||
}, | ||
} |
Oops, something went wrong.