pub struct PluginCache { /* private fields */ }Expand description
SQLite-backed plugin cache.
Implementations§
Source§impl PluginCache
impl PluginCache
pub fn open(path: &Path) -> Result<Self>
Sourcepub fn check(
&self,
path: &str,
mtime_secs: i64,
mtime_nsecs: i64,
) -> Option<i64>
pub fn check( &self, path: &str, mtime_secs: i64, mtime_nsecs: i64, ) -> Option<i64>
Check if a cached entry exists with matching mtime. Returns the plugin id if cache is valid, None if miss.
Sourcepub fn load(&self, plugin_id: i64) -> Result<PluginDelta>
pub fn load(&self, plugin_id: i64) -> Result<PluginDelta>
Load cached delta for a plugin by id.
Sourcepub fn store(
&self,
path: &str,
mtime_secs: i64,
mtime_nsecs: i64,
source_time_ms: u64,
delta: &PluginDelta,
) -> Result<()>
pub fn store( &self, path: &str, mtime_secs: i64, mtime_nsecs: i64, source_time_ms: u64, delta: &PluginDelta, ) -> Result<()>
Store a plugin delta. Replaces any existing entry for this path.
Sourcepub fn count_stale(&self) -> usize
pub fn count_stale(&self) -> usize
Count plugins whose file mtime no longer matches the cache.
Sourcepub fn count_stale_ast(&self) -> usize
pub fn count_stale_ast(&self) -> usize
Count AST cache entries whose file mtime no longer matches.
Sourcepub fn check_ast(
&self,
path: &str,
mtime_secs: i64,
mtime_nsecs: i64,
) -> Option<Vec<u8>>
pub fn check_ast( &self, path: &str, mtime_secs: i64, mtime_nsecs: i64, ) -> Option<Vec<u8>>
Check if a cached AST exists with matching mtime.
Sourcepub fn store_ast(
&self,
path: &str,
mtime_secs: i64,
mtime_nsecs: i64,
ast_bytes: &[u8],
) -> Result<()>
pub fn store_ast( &self, path: &str, mtime_secs: i64, mtime_nsecs: i64, ast_bytes: &[u8], ) -> Result<()>
Store a parsed AST for a script file.
Sourcepub fn check_compaudit(
&self,
dir: &str,
mtime_secs: i64,
mtime_nsecs: i64,
) -> Option<bool>
pub fn check_compaudit( &self, dir: &str, mtime_secs: i64, mtime_nsecs: i64, ) -> Option<bool>
Check if a directory’s security audit result is cached and still valid. Returns Some(is_secure) if cache hit, None if miss or stale.
Sourcepub fn store_compaudit(
&self,
dir: &str,
mtime_secs: i64,
mtime_nsecs: i64,
uid: u32,
mode: u32,
is_secure: bool,
) -> Result<()>
pub fn store_compaudit( &self, dir: &str, mtime_secs: i64, mtime_nsecs: i64, uid: u32, mode: u32, is_secure: bool, ) -> Result<()>
Store a compaudit result for a directory.
Sourcepub fn compaudit_cached(&self, fpath: &[PathBuf]) -> Vec<String>
pub fn compaudit_cached(&self, fpath: &[PathBuf]) -> Vec<String>
Run a full compaudit against fpath directories, using cache where valid. Returns list of insecure directories (empty = all secure).
Auto Trait Implementations§
impl !Freeze for PluginCache
impl !RefUnwindSafe for PluginCache
impl Send for PluginCache
impl !Sync for PluginCache
impl Unpin for PluginCache
impl UnsafeUnpin for PluginCache
impl !UnwindSafe for PluginCache
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