pub struct UpdateCache {
pub checked_at: u64,
pub latest: Option<String>,
pub notified: Option<String>,
}Expand description
<state>/update.json: the last time the repository was asked, and what it said.
Fields§
§checked_at: u64Unix seconds of the last attempt. A failure counts: a server that is down is not asked again until the period is up, or every run would pay for the question.
latest: Option<String>The latest commit the last successful answer named.
notified: Option<String>The commit the notice was last printed for, so it is said once and not on every run.
Implementations§
Source§impl UpdateCache
impl UpdateCache
Sourcepub fn load(path: &Path) -> UpdateCache
pub fn load(path: &Path) -> UpdateCache
A missing or unreadable cache is an empty one: it only ever saves a request.
Sourcepub fn save(&self, path: &Path)
pub fn save(&self, path: &Path)
Best effort and atomic (write beside, rename over): a cache that cannot be written costs a request next time, and must not cost a run.
Sourcepub fn is_due(&self, check: UpdateCheck, now_secs: u64) -> bool
pub fn is_due(&self, check: UpdateCheck, now_secs: u64) -> bool
Whether the repository should be asked now.
Trait Implementations§
Source§impl Clone for UpdateCache
impl Clone for UpdateCache
Source§impl Debug for UpdateCache
impl Debug for UpdateCache
Source§impl Default for UpdateCache
impl Default for UpdateCache
Source§impl<'de> Deserialize<'de> for UpdateCachewhere
UpdateCache: Default,
impl<'de> Deserialize<'de> for UpdateCachewhere
UpdateCache: Default,
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for UpdateCache
Source§impl PartialEq for UpdateCache
impl PartialEq for UpdateCache
Source§impl Serialize for UpdateCache
impl Serialize for UpdateCache
impl StructuralPartialEq for UpdateCache
Auto Trait Implementations§
impl Forget for UpdateCache
impl Freeze for UpdateCache
impl Move for UpdateCache
impl RefUnwindSafe for UpdateCache
impl Send for UpdateCachewhere
RawVecInner: Send,
impl Sync for UpdateCachewhere
RawVecInner: Sync,
impl Unpin for UpdateCache
impl UnsafeUnpin for UpdateCache
impl UnwindSafe for UpdateCachewhere
RawVecInner: UnwindSafe,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.