Skip to main content

Bindings

Struct Bindings 

Source
pub struct Bindings {
    by_session: Mutex<HashMap<(String, String, String), AccountKey>>,
}
Expand description

The session bindings, keyed by the three routing segments.

Fields§

§by_session: Mutex<HashMap<(String, String, String), AccountKey>>

Implementations§

Source§

impl Bindings

Source

pub fn register( &self, registration: &Registration, listener_base: &str, account_env: &HashMap<String, String>, ) -> EnvSet

Register registration and derive the env set its child is stamped with, from the account’s real env. Re-registering the same three segments replaces the prior binding, so a respawned CLI answers to this generation of the session, not the last.

Source

pub fn respawn_env_overrides( &self, registration: &Registration, replaced_session: &str, listener_base: &str, ) -> HashMap<String, String>

Re-register registration and return ONLY the four gateway-owned keys for a respawn’s launch-settings overrides: the base URL naming this listener, the alt base-url slot, the dummy in the account’s credential variable, and the forced-empty API key. The account and project env already live in the bridge from the original spawn, so carrying the whole env here would let a key declared in both layers revert to its account value.

registration.session is the segment the respawned child runs under; replaced_session is the one the child it replaces ran under, dropped under the same lock as the insert, so no lookup lands between the two. Without that drop a session keeps one binding for every id it has ever held.

Source

pub fn binding_for( &self, org: &str, project: &str, session: &str, ) -> Option<AccountKey>

The account bound to the three routing segments, if any.

Source

pub fn take_binding( &self, org: &str, project: &str, session: &str, ) -> Option<AccountKey>

Remove and return the binding for the three routing segments, read and removed under one acquisition. A caller that acts on what it read - cooling the account it has proved exhausted - must not race a re-bind of the same triple between the two, or it cools one account and drops another’s binding.

Source

pub fn bind(&self, org: &str, project: &str, session: &str, account: AccountKey)

Bind a selected account to the three routing segments.

Source

pub fn unbind(&self, org: &str, project: &str, session: &str)

Drop the binding, so the session’s next request selects again.

Source

pub fn unbind_for_account(&self, account: &AccountKey)

Drop every binding onto account, so those sessions select again. The usage probe knows only the account it proved exhausted.

Trait Implementations§

Source§

impl Default for Bindings

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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