pub enum CredentialState {
Fresh,
Refreshing {
prior_failures: u32,
prior_reauth: Option<Box<CredentialState>>,
offline: bool,
},
Failed {
consecutive_failures: u32,
last_error: String,
offline: bool,
},
NeedsReauth {
since_unix: u64,
reason: String,
rejected: bool,
},
}Expand description
Coordination state for one registered credential.
Variants§
Fresh
Registered; last check (if any) said fresh, or never checked yet.
Refreshing
A freshness check or refresh attempt is currently in flight — this
IS the single-flight guard: a second CheckRequested while already
Refreshing gets Event::AlreadyInFlight, never a second
RunFreshnessCheck/RunRefresh. Carries forward the failure count
from whatever Failed state (if any) preceded this attempt — the
only place that count lives, since transitioning through
Refreshing would otherwise lose it before RefreshFailed can read
it back out to increment. prior_reauth keeps the NeedsReauth an
on-demand check started from, so a refusal is put back after any
refresh that doesn’t succeed instead of being forgotten. offline
carries Failed { offline } through the attempt: still offline until
an answer says otherwise.
Failed
Last refresh attempt failed with a transient error (no answer from the
server, a 5xx, a parse failure) — will be retried on the next
ensure_fresh/sweep tick. An unreachable server leaves
consecutive_failures where it was: being offline never counts toward
NEEDS_REAUTH_THRESHOLD.
Fields
NeedsReauth
Either consecutive_failures crossed NEEDS_REAUTH_THRESHOLD, or a
refresh closure explicitly reported
RefreshErrorKind::PermanentAuthFailure (no need to accumulate
failures for an error already known permanent). rejected tells the
two apart: true when the credential itself was refused (only a human
login helps; the sweep stops retrying it), false when answered
transient failures merely piled up (the sweep and on-demand checks keep
retrying, and a recovering server cures it).
Trait Implementations§
Source§impl Clone for CredentialState
impl Clone for CredentialState
Source§fn clone(&self) -> CredentialState
fn clone(&self) -> CredentialState
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 CredentialState
impl Debug for CredentialState
Source§impl PartialEq for CredentialState
impl PartialEq for CredentialState
impl StructuralPartialEq for CredentialState
Auto Trait Implementations§
impl Freeze for CredentialState
impl RefUnwindSafe for CredentialState
impl Send for CredentialState
impl Sync for CredentialState
impl Unpin for CredentialState
impl UnsafeUnpin for CredentialState
impl UnwindSafe for CredentialState
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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