chore: bump deps; fix clippy lints & cleanup

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I4c4815ad145650a07f108614034d2e996a6a6964
This commit is contained in:
raf 2026-03-02 17:05:28 +03:00
commit cd1161ee5d
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
41 changed files with 1528 additions and 953 deletions

View file

@ -14,6 +14,7 @@ use crate::{
storage::DynStorageBackend,
};
/// Report of orphaned, untracked, and moved files.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct OrphanReport {
/// Media items whose files no longer exist on disk.
@ -24,6 +25,7 @@ pub struct OrphanReport {
pub moved_files: Vec<(MediaId, PathBuf, PathBuf)>,
}
/// Action to take when resolving orphans.
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum OrphanAction {
@ -31,6 +33,7 @@ pub enum OrphanAction {
Ignore,
}
/// Report of file integrity verification results.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct VerificationReport {
pub verified: usize,
@ -39,6 +42,7 @@ pub struct VerificationReport {
pub errors: Vec<(MediaId, String)>,
}
/// Status of a media item's file integrity.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum IntegrityStatus {
@ -72,9 +76,15 @@ impl std::str::FromStr for IntegrityStatus {
}
}
/// Detect orphaned media items (files that no longer exist on disk),
/// untracked files (files on disk not in database), and moved files (same hash,
/// different path).
/// Detect orphaned, untracked, and moved files.
///
/// # Arguments
///
/// * `storage` - Storage backend to query
///
/// # Returns
///
/// Report containing orphaned items, untracked files, and moved files
pub async fn detect_orphans(
storage: &DynStorageBackend,
) -> Result<OrphanReport> {