pub struct SelectionFailure {
pub kind: SelectionFailureKind,
pub accounts: Vec<AccountFailure>,
pub earliest_reset_ms: Option<u64>,
pub usage_read_retry_ms: Option<u64>,
}Expand description
A failed automatic selection: the top-level kind, every account’s part in it, and the earliest known reset among limited accounts.
Fields§
§kind: SelectionFailureKind§accounts: Vec<AccountFailure>§earliest_reset_ms: Option<u64>Earliest future cooldown end or exhausted-window reset, epoch ms.
usage_read_retry_ms: Option<u64>For usage_read_failed: when the held usage reads go to the network
again (epoch ms), i.e. the earliest time a new selection reads usage.
Implementations§
Source§impl SelectionFailure
impl SelectionFailure
Sourcepub fn new(kind: SelectionFailureKind) -> SelectionFailure
pub fn new(kind: SelectionFailureKind) -> SelectionFailure
A failure with no per-account detail.
Sourcepub fn from_rejections(
rejections: &[Rejection],
now_ms: u64,
) -> SelectionFailure
pub fn from_rejections( rejections: &[Rejection], now_ms: u64, ) -> SelectionFailure
Classify a NoCapacity result. The headline is what the user can act
on now: it is classified over accounts that aren’t cooling down. A
cooling account’s read failure is shown per account. An account
counts as limited when it is cooling down or at a provider limit,
whatever its last read said; only the other accounts’ kinds pick the
headline; an excluded account (a duplicate of a counted seat) never
does. First match wins: no accounts → no_credentials; a
transient failure on an account that is not limited →
usage_read_failed; every account limited → all_cooling_down;
every account not limited needs a login → credential_rejected; each
needs a login or an action outside synaps (at least one an action) →
action_required; else quota_unknown. The earliest reset is the
earliest time some limited account is usable again: the minimum of
their until, skipping accounts that also need a login or an action
(their cooldown’s end alone won’t make them usable).
Sourcepub fn transient_retry_after_s(&self) -> Option<u64>
pub fn transient_retry_after_s(&self) -> Option<u64>
The shortest Retry-After among the live transient failures, when
every one of them carries one: sending again sooner only repeats
them. None when there is no live transient failure or one has no
Retry-After.
Sourcepub fn login_labels(&self) -> Vec<&str>
pub fn login_labels(&self) -> Vec<&str>
Labels whose failure only a new login fixes, in order.
Sourcepub fn action_labels(&self) -> Vec<&str>
pub fn action_labels(&self) -> Vec<&str>
Labels whose failure needs an action outside synaps, in order.
Sourcepub fn accounts_field(&self) -> String
pub fn accounts_field(&self) -> String
label:kind[:status][:cooling],… — one log field, secret-free.
Trait Implementations§
Source§impl Clone for SelectionFailure
impl Clone for SelectionFailure
Source§fn clone(&self) -> SelectionFailure
fn clone(&self) -> SelectionFailure
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 SelectionFailure
impl Debug for SelectionFailure
Source§impl<'de> Deserialize<'de> for SelectionFailure
impl<'de> Deserialize<'de> for SelectionFailure
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SelectionFailure, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SelectionFailure, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for SelectionFailure
Source§impl PartialEq for SelectionFailure
impl PartialEq for SelectionFailure
Source§impl Serialize for SelectionFailure
impl Serialize for SelectionFailure
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for SelectionFailure
Auto Trait Implementations§
impl Freeze for SelectionFailure
impl RefUnwindSafe for SelectionFailure
impl Send for SelectionFailure
impl Sync for SelectionFailure
impl Unpin for SelectionFailure
impl UnsafeUnpin for SelectionFailure
impl UnwindSafe for SelectionFailure
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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
key and return true if they are equal.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