pub struct MergeExecutor { /* private fields */ }Expand description
Executes real filesystem mutations (symlink / hardlink / delete) for a set of duplicate files.
use oximedia_dedup::merge_strategy::{MergeExecutor, LinkMode};
use std::path::PathBuf;
// Build an executor that replaces duplicates with hard links.
let executor = MergeExecutor::new(LinkMode::Hardlink);
// Dry-run: returns what *would* happen without touching the filesystem.
let primary = PathBuf::from("/media/archive/original.mp4");
let dups = vec![PathBuf::from("/media/inbox/copy.mp4")];
let report = executor.dry_run(&primary, &dups);Implementations§
Source§impl MergeExecutor
impl MergeExecutor
Sourcepub fn apply(
&self,
primary_path: &Path,
duplicates: &[PathBuf],
) -> Result<MergeReport, DedupError>
pub fn apply( &self, primary_path: &Path, duplicates: &[PathBuf], ) -> Result<MergeReport, DedupError>
Apply the configured action to every path in duplicates, treating
primary_path as the canonical file to keep.
The primary path itself is silently skipped if it appears in
duplicates (path equality check using Path::canonicalize if both
exist, falling back to byte comparison otherwise).
§Errors
Returns crate::DedupError::Io for unrecoverable I/O failures.
Cross-device hardlink failures are NOT errors — they produce
AppliedAction::Skipped instead.
Sourcepub fn dry_run(
&self,
primary_path: &Path,
duplicates: &[PathBuf],
) -> Result<MergeReport, DedupError>
pub fn dry_run( &self, primary_path: &Path, duplicates: &[PathBuf], ) -> Result<MergeReport, DedupError>
Preview what apply would do without touching the
filesystem.
The returned MergeReport describes the intended actions. No files
are created, removed, or modified.
§Errors
Currently infallible (always returns Ok), but uses the same error
type as apply for API symmetry.
Sourcepub fn apply_resolution(
&self,
resolution: &MergeResolution,
) -> Result<MergeReport, DedupError>
pub fn apply_resolution( &self, resolution: &MergeResolution, ) -> Result<MergeReport, DedupError>
Execute a pre-computed MergeResolution produced by MergeResolver.
This bridges the selection phase (which file to keep) with the execution phase (actually modifying the filesystem).
§Errors
Returns crate::DedupError::Io for unrecoverable I/O failures.
Trait Implementations§
Source§impl Clone for MergeExecutor
impl Clone for MergeExecutor
Source§fn clone(&self) -> MergeExecutor
fn clone(&self) -> MergeExecutor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for MergeExecutor
Auto Trait Implementations§
impl Freeze for MergeExecutor
impl RefUnwindSafe for MergeExecutor
impl Send for MergeExecutor
impl Sync for MergeExecutor
impl Unpin for MergeExecutor
impl UnsafeUnpin for MergeExecutor
impl UnwindSafe for MergeExecutor
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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