pub struct DuplicateDetector;Expand description
Duplicate detection service
Implementations§
Source§impl DuplicateDetector
impl DuplicateDetector
Sourcepub fn find_duplicates(
conn: &Connection,
drive_root: &Path,
) -> Result<Vec<DuplicateGroup>>
pub fn find_duplicates( conn: &Connection, drive_root: &Path, ) -> Result<Vec<DuplicateGroup>>
Find all exact duplicate groups in the database
Returns groups where 2+ photos share the same SHA256 hash.
Sourcepub fn find_perceptual_duplicates(
conn: &Connection,
drive_root: &Path,
exclude_ids: &HashSet<i64>,
) -> Result<Vec<DuplicateGroup>>
pub fn find_perceptual_duplicates( conn: &Connection, drive_root: &Path, exclude_ids: &HashSet<i64>, ) -> Result<Vec<DuplicateGroup>>
Find perceptually-similar duplicate groups (re-edits, re-saves,
quality-adjusted exports). Computes phash on demand for any
photo where it’s NULL and persists into photos.phash, then
groups by Hamming distance ≤ 10 across the 64-bit hashes.
Excludes photos already grouped as exact duplicates so the UI doesn’t show the same pair twice.
pub fn find_perceptual_duplicates_with_progress( conn: &Connection, drive_root: &Path, exclude_ids: &HashSet<i64>, cancel: Option<&AtomicBool>, progress: impl FnMut(DuplicateProgress), ) -> Result<Vec<DuplicateGroup>>
Sourcepub fn calculate_wasted_space(conn: &Connection) -> Result<u64>
pub fn calculate_wasted_space(conn: &Connection) -> Result<u64>
Wasted bytes across the duplicate listing.
Counts every detected duplicate group — both byte-exact dupes (same file_hash) AND perceptual ones (pHash match). The earlier version of this function only summed exact matches, which on a perceptual-only library reported “0 MB potentially wasted” even when the listing had dozens of groups. Now: walk the duplicate_groups table directly and sum (total_size - largest) per group, since the user’s win is keeping one copy and trashing the rest.
Auto Trait Implementations§
impl Freeze for DuplicateDetector
impl RefUnwindSafe for DuplicateDetector
impl Send for DuplicateDetector
impl Sync for DuplicateDetector
impl Unpin for DuplicateDetector
impl UnsafeUnpin for DuplicateDetector
impl UnwindSafe for DuplicateDetector
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more