pub struct Checker { /* private fields */ }Expand description
Throttled release checker.
Implementations§
Source§impl Checker
impl Checker
Sourcepub fn new(cfg: &Update) -> Option<Self>
pub fn new(cfg: &Update) -> Option<Self>
Build a checker honouring cfg, or None when checking is off.
The Option had no None arm: every caller that asked for a checker
got one, so [update] mode = "off" was honoured by the notify path
alone (see [cached_update], which matches on the mode itself) and
ignored everywhere else. POST /api/upgrade therefore called the
GitHub releases API on a deck configured never to check - and so did
every unit test that reached that route, unauthenticated, against
GitHub’s 60-per-hour-per-address limit.
An operator who writes mode = "off" means it. The button is still
theirs to press; what it may not do is go to the network behind a
configuration that says not to.
Sourcepub fn should_check(&self) -> bool
pub fn should_check(&self) -> bool
Is a check due?
Sourcepub async fn newer_release(&self) -> Result<Option<LatestRelease>>
pub async fn newer_release(&self) -> Result<Option<LatestRelease>>
Ask the forge now: is there a release newer than this build?
Unlike Checker::cached_update this is not throttled, because the
caller is an operator who just pressed a button and is owed an answer
about the state of the world rather than about the last time magi
looked.
Sourcepub fn cached_update(&self) -> Option<LatestRelease>
pub fn cached_update(&self) -> Option<LatestRelease>
A newer release already known from a previous run.
One-line “a newer version exists” banner.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Checker
impl RefUnwindSafe for Checker
impl Send for Checker
impl Sync for Checker
impl Unpin for Checker
impl UnsafeUnpin for Checker
impl UnwindSafe for Checker
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> 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