pub struct KeyActivityLog {
pub events: Vec<ConnectEvent>,
}Fields§
§events: Vec<ConnectEvent>Implementations§
Source§impl KeyActivityLog
impl KeyActivityLog
Sourcepub fn load() -> Self
pub fn load() -> Self
Read the log from disk, pruning anything past the retention window.
Missing files yield an empty log. Corrupt files are renamed aside
to <path>.corrupt-<unix_ts> before defaulting so a future
debugger can recover the data.
Sourcepub fn record(&mut self, alias: &str, now: u64)
pub fn record(&mut self, alias: &str, now: u64)
Append an event for alias at the supplied now timestamp.
Prunes anything past the retention window using the same now
so the prune cutoff matches the recorded event. Caller decides
whether to flush; production call sites pass now_secs().
Sourcepub fn flush(&self) -> Result<()>
pub fn flush(&self) -> Result<()>
Serialize to JSON and write atomically. Suppressed in demo mode so
--demo never mutates the user’s real activity log. Tests that
exercise this path set PATH_OVERRIDE to redirect writes into a
tempdir, so the demo check fires uniformly in production and tests.
The demo-suppress branch logs intent so --demo --verbose shows
that recording is happening, just not landing on disk.
Sourcepub fn record_oneshot(alias: &str, now: u64)
pub fn record_oneshot(alias: &str, now: u64)
One-shot record. For non-TUI call sites (CLI mode) that do not
hold an in-memory log between connects. Caller passes now;
production CLI paths pass now_secs().
Sourcepub fn last_use_for_aliases(&self, aliases: &[String]) -> Option<u64>
pub fn last_use_for_aliases(&self, aliases: &[String]) -> Option<u64>
Timestamp of the most recent event whose alias appears in aliases.
Sourcepub fn timestamps_for_aliases(&self, aliases: &[String]) -> Vec<u64>
pub fn timestamps_for_aliases(&self, aliases: &[String]) -> Vec<u64>
All event timestamps for the given aliases, used by the shared activity chart renderer which auto-scales the time window from the oldest entry.
Trait Implementations§
Source§impl Clone for KeyActivityLog
impl Clone for KeyActivityLog
Source§fn clone(&self) -> KeyActivityLog
fn clone(&self) -> KeyActivityLog
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for KeyActivityLog
impl Debug for KeyActivityLog
Source§impl Default for KeyActivityLog
impl Default for KeyActivityLog
Source§fn default() -> KeyActivityLog
fn default() -> KeyActivityLog
Source§impl<'de> Deserialize<'de> for KeyActivityLog
impl<'de> Deserialize<'de> for KeyActivityLog
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for KeyActivityLog
impl RefUnwindSafe for KeyActivityLog
impl Send for KeyActivityLog
impl Sync for KeyActivityLog
impl Unpin for KeyActivityLog
impl UnsafeUnpin for KeyActivityLog
impl UnwindSafe for KeyActivityLog
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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