pub struct UpdateCheckCache {
pub last_checked: Option<DateTime<Utc>>,
pub latest_seen: Option<String>,
}Expand description
In-memory view of ~/.config/dsp-cli/update_check.toml.
Load with UpdateCheckCache::load (or UpdateCheckCache::load_from
in tests). Persist with UpdateCheckCache::save (or
UpdateCheckCache::save_to in tests).
Fields§
§last_checked: Option<DateTime<Utc>>When the crates.io sparse index was last fetched (successfully or not — a failed attempt still counts, so the 24h backoff holds).
latest_seen: Option<String>The highest stable version last observed on the index, as a plain
string (re-parsed through semver::Version before use — see
run_check_and_notify’s sanitisation guard).
Implementations§
Source§impl UpdateCheckCache
impl UpdateCheckCache
Sourcepub fn default_path() -> Result<PathBuf, Diagnostic>
pub fn default_path() -> Result<PathBuf, Diagnostic>
The canonical cache path: ~/.config/dsp-cli/update_check.toml.
Returns an error if the home directory cannot be resolved. Note this
is the one failure default_path itself can produce; callers of
Self::load still degrade it to Self::default() rather than
propagating it, per this cache’s disposable-on-failure contract.
Sourcepub fn load() -> Self
pub fn load() -> Self
Load the cache from Self::default_path.
Every failure — including an unresolvable home directory — degrades
to Self::default() (logged at tracing::debug!). This cache is
disposable; no failure here is ever surfaced as an error.
Sourcepub fn load_from(path: &Path) -> Self
pub fn load_from(path: &Path) -> Self
Load the cache from an explicit path.
Unlike crate::config::auth_cache::AuthCache::load_from, every
failure path here — missing file, oversize file, unreadable file,
malformed TOML — degrades to Self::default() rather than an Err.
Sourcepub fn save(&self) -> Result<(), Diagnostic>
pub fn save(&self) -> Result<(), Diagnostic>
Save the cache to Self::default_path.
Unlike load, a save failure is real and is returned as Err — the
caller (a later plan step) decides whether to swallow it.