pub struct IncrementalState {
pub files: HashMap<PathBuf, FileState>,
}Expand description
The incremental state, tracking which files have been indexed.
Fields§
§files: HashMap<PathBuf, FileState>Map from file path to its last indexed state.
Implementations§
Source§impl IncrementalState
impl IncrementalState
Sourcepub fn load(path: &Path) -> Result<Self, IndexError>
pub fn load(path: &Path) -> Result<Self, IndexError>
Load incremental state from disk.
Sourcepub fn detect_changes(&self, current_files: &[PathBuf]) -> FileChanges
pub fn detect_changes(&self, current_files: &[PathBuf]) -> FileChanges
Detect changes between the current file system state and the last index.
Sourcepub fn update_file(
&mut self,
path: PathBuf,
content: &[u8],
chunk_ids: Vec<u64>,
)
pub fn update_file( &mut self, path: PathBuf, content: &[u8], chunk_ids: Vec<u64>, )
Update the state for a file that has been indexed.
Sourcepub fn remove_file(&mut self, path: &Path) -> Option<FileState>
pub fn remove_file(&mut self, path: &Path) -> Option<FileState>
Remove a file from the incremental state.
Sourcepub fn chunk_ids_for_file(&self, path: &Path) -> Vec<u64>
pub fn chunk_ids_for_file(&self, path: &Path) -> Vec<u64>
Get chunk IDs associated with a file.
Sourcepub fn chunk_ids_to_remove(&self, deleted_files: &[PathBuf]) -> Vec<u64>
pub fn chunk_ids_to_remove(&self, deleted_files: &[PathBuf]) -> Vec<u64>
Get all chunk IDs from deleted files.
Sourcepub fn apply_deletions(&mut self, deleted_files: &[PathBuf]) -> Vec<u64>
pub fn apply_deletions(&mut self, deleted_files: &[PathBuf]) -> Vec<u64>
Merge changes: remove deleted file entries, return IDs to remove from index.
Trait Implementations§
Source§impl Debug for IncrementalState
impl Debug for IncrementalState
Source§impl Default for IncrementalState
impl Default for IncrementalState
Source§fn default() -> IncrementalState
fn default() -> IncrementalState
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for IncrementalState
impl<'de> Deserialize<'de> for IncrementalState
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for IncrementalState
impl RefUnwindSafe for IncrementalState
impl Send for IncrementalState
impl Sync for IncrementalState
impl Unpin for IncrementalState
impl UnsafeUnpin for IncrementalState
impl UnwindSafe for IncrementalState
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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