pub struct PoolRegistry { /* private fields */ }Expand description
The account-agnostic registry of session pools, keyed by (account, user).
Cheap to clone (everything is behind Arc). The map mutex is std (never held
across .await); the shared auth gate serializes browser auths across pools.
Implementations§
Source§impl PoolRegistry
impl PoolRegistry
Sourcepub fn get_or_create(&self, key: &SessionKey, max: usize) -> Arc<SessionPool> ⓘ
pub fn get_or_create(&self, key: &SessionKey, max: usize) -> Arc<SessionPool> ⓘ
Returns the pool for key, creating an empty one (no auth) if absent.
New pools share the registry’s auth gate, so all browser auths across all
pools are serialized to one at a time.
Sourcepub fn get(&self, key: &SessionKey) -> Option<Arc<SessionPool>>
pub fn get(&self, key: &SessionKey) -> Option<Arc<SessionPool>>
Returns the pool for key without creating one (unlike
get_or_create). Used by read-only paths like
cancel that must not spin up an empty pool.
Sourcepub fn get_by_id(&self, id: u64) -> Option<Arc<SessionPool>>
pub fn get_by_id(&self, id: u64) -> Option<Arc<SessionPool>>
Returns the pool with the given id, if present, without creating one.
Sourcepub fn remove(&self, key: &SessionKey) -> Option<Arc<SessionPool>>
pub fn remove(&self, key: &SessionKey) -> Option<Arc<SessionPool>>
Removes the pool for key. Returns it if present.
Sourcepub fn remove_by_id(&self, id: u64) -> Option<Arc<SessionPool>>
pub fn remove_by_id(&self, id: u64) -> Option<Arc<SessionPool>>
Removes the pool with the given id. Returns it if present.
Sourcepub fn take_all(&self) -> Vec<Arc<SessionPool>>
pub fn take_all(&self) -> Vec<Arc<SessionPool>>
Drains and returns every pool.
Sourcepub fn pools(&self) -> Vec<Arc<SessionPool>>
pub fn pools(&self) -> Vec<Arc<SessionPool>>
Live handles to every pool, ordered by id, without draining the registry. Used by the keep-alive heartbeat to visit each pool.
Sourcepub fn snapshot(&self) -> Vec<SessionInfo>
pub fn snapshot(&self) -> Vec<SessionInfo>
A snapshot of every pool, ordered by id. Sync; no awaits.
Trait Implementations§
Source§impl Clone for PoolRegistry
impl Clone for PoolRegistry
Source§fn clone(&self) -> PoolRegistry
fn clone(&self) -> PoolRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for PoolRegistry
impl !UnwindSafe for PoolRegistry
impl Freeze for PoolRegistry
impl Send for PoolRegistry
impl Sync for PoolRegistry
impl Unpin for PoolRegistry
impl UnsafeUnpin for PoolRegistry
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,
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