pub struct ContentCache { /* private fields */ }Expand description
Cache of content hashes for incremental processing.
Implementations§
Source§impl ContentCache
impl ContentCache
pub fn new() -> Self
Sourcepub fn from_entries(entries: Vec<(String, String)>) -> Self
pub fn from_entries(entries: Vec<(String, String)>) -> Self
Load cache from a list of (path, hash) pairs (e.g., from DB).
Sourcepub fn compute_hash(content: &[u8]) -> String
pub fn compute_hash(content: &[u8]) -> String
Compute SHA-256 hash of file content.
Sourcepub fn needs_processing(&self, relative_path: &str, content: &[u8]) -> bool
pub fn needs_processing(&self, relative_path: &str, content: &[u8]) -> bool
Check if a file has changed since last scan. Returns true if the file is new or changed (needs processing).
Sourcepub fn update(&mut self, relative_path: String, content: &[u8])
pub fn update(&mut self, relative_path: String, content: &[u8])
Update the stored hash for a file.
Sourcepub fn entries(&self) -> Vec<(&str, &str)>
pub fn entries(&self) -> Vec<(&str, &str)>
Get all current cache entries (for persisting to DB).
Sourcepub fn process_batch<F>(
&mut self,
files: &[(String, Vec<u8>)],
processor: F,
) -> ScanResult
pub fn process_batch<F>( &mut self, files: &[(String, Vec<u8>)], processor: F, ) -> ScanResult
Process a batch of files, skipping unchanged ones.
files: (relative_path, content) pairs
processor: function to call for each file that needs processing
Returns ScanResult with counts and timing.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ContentCache
impl RefUnwindSafe for ContentCache
impl Send for ContentCache
impl Sync for ContentCache
impl Unpin for ContentCache
impl UnsafeUnpin for ContentCache
impl UnwindSafe for ContentCache
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