pub struct ChangeDetector { /* private fields */ }Expand description
Tracks file content hashes for incremental change detection.
Implementations§
Source§impl ChangeDetector
impl ChangeDetector
Sourcepub fn load_from_storage(&mut self, storage: &dyn StorageBackend)
pub fn load_from_storage(&mut self, storage: &dyn StorageBackend)
Load previously known hashes from storage.
This reads from the file_hashes table if it exists. If the table
doesn’t exist or the query fails, starts fresh with no known hashes.
Sourcepub fn save_to_storage(
&self,
storage: &dyn StorageBackend,
) -> Result<(), CodememError>
pub fn save_to_storage( &self, storage: &dyn StorageBackend, ) -> Result<(), CodememError>
Save current hashes to storage.
Sourcepub fn check_changed(&self, path: &str, content: &[u8]) -> (bool, String)
pub fn check_changed(&self, path: &str, content: &[u8]) -> (bool, String)
Check if a file has changed and return (changed, hash) to avoid double-hashing.
Callers can pass the returned hash to record_hash to skip recomputation.
Sourcepub fn record_hash(&mut self, path: &str, hash: String)
pub fn record_hash(&mut self, path: &str, hash: String)
Record a pre-computed hash for a file (avoids re-hashing when used with check_changed).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ChangeDetector
impl RefUnwindSafe for ChangeDetector
impl Send for ChangeDetector
impl Sync for ChangeDetector
impl Unpin for ChangeDetector
impl UnsafeUnpin for ChangeDetector
impl UnwindSafe for ChangeDetector
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