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
impl Bindings
Sourcepub fn register(
&self,
registration: &Registration,
listener_base: &str,
account_env: &HashMap<String, String>,
) -> EnvSet
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.
Sourcepub fn respawn_env_overrides(
&self,
registration: &Registration,
replaced_session: &str,
listener_base: &str,
) -> HashMap<String, String>
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.
Sourcepub fn binding_for(
&self,
org: &str,
project: &str,
session: &str,
) -> Option<AccountKey>
pub fn binding_for( &self, org: &str, project: &str, session: &str, ) -> Option<AccountKey>
The account bound to the three routing segments, if any.
Sourcepub fn take_binding(
&self,
org: &str,
project: &str,
session: &str,
) -> Option<AccountKey>
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.
Sourcepub fn bind(&self, org: &str, project: &str, session: &str, account: AccountKey)
pub fn bind(&self, org: &str, project: &str, session: &str, account: AccountKey)
Bind a selected account to the three routing segments.
Sourcepub fn unbind(&self, org: &str, project: &str, session: &str)
pub fn unbind(&self, org: &str, project: &str, session: &str)
Drop the binding, so the session’s next request selects again.
Sourcepub fn unbind_for_account(&self, account: &AccountKey)
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.