pub struct VersionCheckCache {
pub latest_version: String,
pub current_version: String,
pub checked_at: DateTime<Utc>,
pub update_available: bool,
pub notified: bool,
pub notification_count: u32,
}Expand description
Cached version information with notification tracking.
This structure stores version check results along with timestamps and notification state to provide intelligent update prompting.
§Fields
latest_version- The latest version string from GitHub releasescurrent_version- The version that was running when cachedchecked_at- UTC timestamp when this information was fetchedupdate_available- Whether an update was available at check timenotified- Whether the user has been notified about this updatenotification_count- Number of times user has been notified
§Serialization
This struct is serialized to JSON for persistent caching between AGPM runs.
Fields§
§latest_version: StringThe latest version string from GitHub releases (e.g., “0.4.0”).
current_version: StringThe version that was running when this cache was created.
checked_at: DateTime<Utc>UTC timestamp when this version information was fetched.
update_available: boolWhether an update was available at the time of check.
notified: boolWhether the user has been notified about this specific update.
notification_count: u32Number of times the user has been notified about this update.
Implementations§
Source§impl VersionCheckCache
impl VersionCheckCache
Sourcepub fn new(current_version: String, latest_version: String) -> Self
pub fn new(current_version: String, latest_version: String) -> Self
Create a new cache entry from version information.
Sourcepub fn is_valid(&self, interval_seconds: u64) -> bool
pub fn is_valid(&self, interval_seconds: u64) -> bool
Check if the cache is still valid based on the given interval.
Sourcepub const fn mark_notified(&mut self)
pub const fn mark_notified(&mut self)
Mark this update as notified and increment the count.
Sourcepub fn should_notify(&self) -> bool
pub fn should_notify(&self) -> bool
Check if we should notify about this update.
Implements a backoff strategy to avoid notification fatigue:
- First notification: immediate
- Subsequent notifications: with increasing intervals
Trait Implementations§
Source§impl Debug for VersionCheckCache
impl Debug for VersionCheckCache
Source§impl<'de> Deserialize<'de> for VersionCheckCache
impl<'de> Deserialize<'de> for VersionCheckCache
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 VersionCheckCache
impl RefUnwindSafe for VersionCheckCache
impl Send for VersionCheckCache
impl Sync for VersionCheckCache
impl Unpin for VersionCheckCache
impl UnwindSafe for VersionCheckCache
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> 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>
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