pub struct FrecencyTracker { /* private fields */ }Implementations§
Source§impl FrecencyTracker
impl FrecencyTracker
pub fn new(db_path: impl AsRef<Path>, use_unsafe_no_lock: bool) -> Result<Self>
Sourcepub fn spawn_gc(
shared: SharedFrecency,
db_path: String,
use_unsafe_no_lock: bool,
) -> Result<JoinHandle<()>>
pub fn spawn_gc( shared: SharedFrecency, db_path: String, use_unsafe_no_lock: bool, ) -> Result<JoinHandle<()>>
Spawns a background thread to purge stale frecency entries and compact the database. Run it once in a while to purge old pages and keep DB file size reasonable.
It’s okay to not join this thread since it acquires locks for the db access
use fff_search::frecency::FrecencyTracker;
use fff_search::SharedFrecency;
let shared_frecency: SharedFrecency = Default::default();
let _ = FrecencyTracker::spawn_gc(shared_frecency, "/path/to/frecency_db".into(), true).ok();Sourcepub fn seconds_since_last_access(&self, path: &Path) -> Result<Option<u64>>
pub fn seconds_since_last_access(&self, path: &Path) -> Result<Option<u64>>
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<()>
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