pub struct FrecencyTracker { /* private fields */ }Implementations§
Source§impl FrecencyTracker
impl FrecencyTracker
pub fn new(db_path: &str, use_unsafe_no_lock: bool) -> Result<Self, Error>
Sourcepub fn spawn_gc(
shared: SharedFrecency,
db_path: String,
use_unsafe_no_lock: bool,
)
pub fn spawn_gc( shared: SharedFrecency, db_path: String, use_unsafe_no_lock: bool, )
Spawns a background thread to purge stale frecency entries and compact the database.
Phase 1 (read lock): purge stale entries — deletes expired entries and prunes old timestamps. Phase 2 (write lock): compact the database by re-writing entries into a fresh LMDB env. We can’t use LMDB’s copy_to_path with NO_LOCK envs (MDB_INCOMPATIBLE), so instead we: read all entries → drop env → delete files → reopen → write back.
Sourcepub fn seconds_since_last_access(
&self,
path: &Path,
) -> Result<Option<u64>, Error>
pub fn seconds_since_last_access( &self, path: &Path, ) -> Result<Option<u64>, Error>
Returns seconds since the most recent tracked access, or None if the
file has never been tracked.
pub fn track_access(&self, path: &Path) -> Result<(), Error>
pub fn get_access_score(&self, file_path: &Path, mode: FFFMode) -> i64
Trait Implementations§
Source§impl DbHealthChecker for FrecencyTracker
impl DbHealthChecker for FrecencyTracker
Auto Trait Implementations§
impl Freeze for FrecencyTracker
impl RefUnwindSafe for FrecencyTracker
impl Send for FrecencyTracker
impl Sync for FrecencyTracker
impl Unpin for FrecencyTracker
impl UnsafeUnpin for FrecencyTracker
impl UnwindSafe for FrecencyTracker
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