pub struct FileCache { /* private fields */ }Expand description
Cache for storing file analysis results and metadata
Implementations§
Source§impl FileCache
impl FileCache
Sourcepub fn new<P: AsRef<Path>>(cache_path: P) -> Self
pub fn new<P: AsRef<Path>>(cache_path: P) -> Self
Create a new file cache with the given cache file path
Sourcepub fn load(&mut self) -> GuardianResult<()>
pub fn load(&mut self) -> GuardianResult<()>
Load cache from disk, creating it if it doesn’t exist
Sourcepub fn save(&mut self) -> GuardianResult<()>
pub fn save(&mut self) -> GuardianResult<()>
Save cache to disk if it has been modified
Sourcepub fn needs_analysis<P: AsRef<Path>>(
&mut self,
file_path: P,
config_fingerprint: &str,
) -> GuardianResult<bool>
pub fn needs_analysis<P: AsRef<Path>>( &mut self, file_path: P, config_fingerprint: &str, ) -> GuardianResult<bool>
Check if a file needs to be re-analyzed
Sourcepub fn update_entry<P: AsRef<Path>>(
&mut self,
file_path: P,
violation_count: usize,
config_fingerprint: &str,
) -> GuardianResult<()>
pub fn update_entry<P: AsRef<Path>>( &mut self, file_path: P, violation_count: usize, config_fingerprint: &str, ) -> GuardianResult<()>
Update cache entry for a file after analysis
Sourcepub fn statistics(&self) -> CacheStatistics
pub fn statistics(&self) -> CacheStatistics
Get cache statistics
Sourcepub fn clear(&mut self) -> GuardianResult<()>
pub fn clear(&mut self) -> GuardianResult<()>
Clear the entire cache
Sourcepub fn cleanup(&mut self) -> GuardianResult<usize>
pub fn cleanup(&mut self) -> GuardianResult<usize>
Remove cache entries for files that no longer exist
Sourcepub fn set_config_fingerprint(&mut self, fingerprint: String)
pub fn set_config_fingerprint(&mut self, fingerprint: String)
Update configuration fingerprint
Source§impl FileCache
impl FileCache
Sourcepub fn validate_cache_coherence(&self) -> GuardianResult<()>
pub fn validate_cache_coherence(&self) -> GuardianResult<()>
Self-validation - Infrastructure validates its own coherence
Architecture Principle: Self-validating infrastructure - Components ensure their own correctness
- Cache validates its invariants during normal operation
- File hash verification maintains cache coherence
- Metadata consistency checked on each operation
- No external test dependencies - system is self-aware
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FileCache
impl RefUnwindSafe for FileCache
impl Send for FileCache
impl Sync for FileCache
impl Unpin for FileCache
impl UnwindSafe for FileCache
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