pub struct IncrementalIndex { /* private fields */ }Expand description
Persistent index for incremental deduplication.
Tracks which files have been seen and their state at the time of the last scan, enabling subsequent scans to skip unchanged files.
Implementations§
Source§impl IncrementalIndex
impl IncrementalIndex
Sourcepub fn tracked_count(&self) -> usize
pub fn tracked_count(&self) -> usize
Number of tracked files.
Sourcepub fn scan_count(&self) -> u64
pub fn scan_count(&self) -> u64
Number of scans completed.
Sourcepub fn last_scan_epoch(&self) -> u64
pub fn last_scan_epoch(&self) -> u64
Epoch of the last scan.
Sourcepub fn classify(&self, path: &Path) -> DedupResult<(FileChange, FileState)>
pub fn classify(&self, path: &Path) -> DedupResult<(FileChange, FileState)>
Classify a single file against the stored state.
§Errors
Returns an error if the file’s metadata cannot be read.
Sourcepub fn scan(&self, candidates: &[PathBuf]) -> ScanResult
pub fn scan(&self, candidates: &[PathBuf]) -> ScanResult
Perform an incremental scan over a list of candidate paths.
Classifies each file, identifies deleted files (tracked but not in
the candidate list), and returns a ScanResult.
Does not update the index – call commit after processing.
Sourcepub fn commit(&mut self, paths: &[PathBuf])
pub fn commit(&mut self, paths: &[PathBuf])
Commit processed files to the index, updating their state.
Call this after successfully processing the files from a scan.
Sourcepub fn commit_file(&mut self, path: &Path, state: FileState)
pub fn commit_file(&mut self, path: &Path, state: FileState)
Commit a single file with an explicit state (e.g. with content hash).
Sourcepub fn prune_deleted(&mut self, deleted: &[PathBuf])
pub fn prune_deleted(&mut self, deleted: &[PathBuf])
Remove deleted files from the index.
Sourcepub fn is_tracked(&self, path: &Path) -> bool
pub fn is_tracked(&self, path: &Path) -> bool
Check if a file is tracked.
Sourcepub fn to_json(&self) -> DedupResult<String>
pub fn to_json(&self) -> DedupResult<String>
Sourcepub fn from_json(json: &str) -> DedupResult<Self>
pub fn from_json(json: &str) -> DedupResult<Self>
Sourcepub fn save_to_file(&self, path: &Path) -> DedupResult<()>
pub fn save_to_file(&self, path: &Path) -> DedupResult<()>
Sourcepub fn load_from_file(path: &Path) -> DedupResult<Self>
pub fn load_from_file(path: &Path) -> DedupResult<Self>
Sourcepub fn tracked_paths(&self) -> Vec<String>
pub fn tracked_paths(&self) -> Vec<String>
Return all tracked file paths.
Sourcepub fn merge(&mut self, other: &IncrementalIndex)
pub fn merge(&mut self, other: &IncrementalIndex)
Merge another index into this one. Files in other override this index.
Trait Implementations§
Source§impl Clone for IncrementalIndex
impl Clone for IncrementalIndex
Source§fn clone(&self) -> IncrementalIndex
fn clone(&self) -> IncrementalIndex
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for IncrementalIndex
impl Debug for IncrementalIndex
Source§impl Default for IncrementalIndex
impl Default for IncrementalIndex
Source§impl<'de> Deserialize<'de> for IncrementalIndex
impl<'de> Deserialize<'de> for IncrementalIndex
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for IncrementalIndex
impl RefUnwindSafe for IncrementalIndex
impl Send for IncrementalIndex
impl Sync for IncrementalIndex
impl Unpin for IncrementalIndex
impl UnsafeUnpin for IncrementalIndex
impl UnwindSafe for IncrementalIndex
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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