Skip to main content

AccountPool

Struct AccountPool 

Source
pub struct AccountPool {
    accounts: Mutex<AccountStateMap>,
}
Expand description

The account state map, behind one handle.

Fields§

§accounts: Mutex<AccountStateMap>

Implementations§

Source§

impl AccountPool

Source

pub fn new(specs: &[LoadedAccount]) -> Self

Source

pub fn empty_for_test() -> Self

Empty map for the testing feature’s Workspace::testing_stub.

Source

pub fn all_loaded(&self) -> bool

Source

pub fn usage(&self, display_name: &str) -> Option<UsageSnapshot>

Source

pub fn latest_reading(&self, display_name: &str) -> Option<UsageSnapshot>

The newest reading a view draws: a rate-limited response’s windows when one landed after the last successful probe, else that probe’s snapshot.

Source

pub fn usage_error(&self, display_name: &str) -> Option<UsageFetchStatus>

Source

pub fn auth(&self, display_name: &str) -> Option<AccountAuth>

Source

pub fn env(&self, key: &AccountKey) -> Option<HashMap<String, String>>

Source

pub fn provider(&self, key: &AccountKey) -> Option<Provider>

Source

pub fn loading_state(&self, key: &AccountKey) -> LoadingState

Source

pub fn is_saturated(&self, key: &AccountKey) -> bool

Source

pub fn unusable_reason(&self, key: &AccountKey) -> Option<Unusable>

Source

pub fn scheduler_should_probe(&self, key: &AccountKey) -> bool

Source

pub fn should_probe_now(&self, key: &AccountKey) -> bool

Source

pub fn set_usage(&self, key: &AccountKey, snapshot: UsageSnapshot)

Source

pub fn set_loading(&self, key: &AccountKey, loading: LoadingState)

Source

pub fn set_limit_reading(&self, key: &AccountKey, snapshot: UsageSnapshot)

Source

pub fn set_last_error( &self, key: &AccountKey, status: UsageFetchStatus, retry_after: Option<Duration>, )

Source

pub fn clear_last_error(&self, key: &AccountKey)

Source

pub fn disarm_override(&self, key: &AccountKey)

Source

pub fn seed_from_cache(&self, cached: &BTreeMap<String, UsageSnapshot>)

Source

pub fn snapshots_for_cache(&self) -> BTreeMap<String, UsageSnapshot>

Source

pub fn account_names(&self) -> Vec<String>

Source

pub fn ordered_account_keys(&self) -> Vec<AccountKey>

The account keys in declaration order.

Source

pub fn next_probe_after(&self, key: &AccountKey) -> Option<Duration>

How long until the account’s next scheduled probe, when one is pending.

Source

pub fn probe_entries( &self, ) -> Vec<(AccountKey, Provider, HashMap<String, String>)>

The poller’s work list: every account due a probe, with its provider and env.

Source

pub fn disarm_backoff_overrides(&self, keys: &[AccountKey])

Disarm the one-shot reset-clear override for accounts whose backoff is genuinely active.

Source

pub fn select_account( &self, pin: &OrgPin, org: &str, model: &str, ) -> Result<AccountKey, SelectionError>

Run the declared-model selection walk for one org pin.

Source

pub fn declares(&self, key: &AccountKey, model: &str) -> bool

true when the account serves model. An unknown account serves nothing.

Source

pub fn model_slug_for( &self, key: &AccountKey, canonical: &str, ) -> Option<String>

The upstream slug the account maps canonical to, when the account declares a different upstream spelling. None forwards the canonical name unchanged.

Source

pub fn set_model_slug(&self, key: &AccountKey, canonical: &str, slug: &str)

Set a slug mapping on one account. Test setup only - production slugs arrive through the config-loaded state map.

Source

pub fn provider_and_env( &self, key: &AccountKey, ) -> Option<(Provider, HashMap<String, String>)>

The provider and env of one account, for credential resolution.

Source

pub fn replace_state_for_test(&self, map: AccountStateMap)

Replace the whole state map. Test fixture setup only.

Source

pub fn replace_accounts(&self, specs: &[LoadedAccount])

Replace the account set with one a config reload produced.

Health for an account present in both sets is carried across: a reload is not a reason to blank the usage bars, and resetting a terminal LoadingState would make a ready account unspawnable until its next probe. An account new to the set starts Loading.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more