pub struct ClientRegistry { /* private fields */ }Expand description
Registry of all connected clients.
Implementations§
Source§impl ClientRegistry
impl ClientRegistry
Sourcepub fn with_default_quota(quota: ClientQuota) -> Self
pub fn with_default_quota(quota: ClientQuota) -> Self
Creates a registry with custom default quota.
Sourcepub fn get_or_create(&self, client_id: ClientId) -> Arc<ClientResources>
pub fn get_or_create(&self, client_id: ClientId) -> Arc<ClientResources>
Gets or creates a client resource tracker.
Sourcepub fn register_client(&self, client_id: ClientId, quota: ClientQuota)
pub fn register_client(&self, client_id: ClientId, quota: ClientQuota)
Registers a client with a custom quota.
Sourcepub fn get_quota(&self, client_id: ClientId) -> ClientQuota
pub fn get_quota(&self, client_id: ClientId) -> ClientQuota
Gets the quota for a client.
Sourcepub fn can_admit(&self, client_id: ClientId) -> bool
pub fn can_admit(&self, client_id: ClientId) -> bool
Checks if a client’s request should be admitted.
Sourcepub fn record_request(&self, client_id: ClientId) -> bool
pub fn record_request(&self, client_id: ClientId) -> bool
Records a request from a client.
Sourcepub fn record_response(&self, client_id: ClientId)
pub fn record_response(&self, client_id: ClientId)
Records a response to a client.
Sourcepub fn client_stats(&self, client_id: ClientId) -> Option<ClientStats>
pub fn client_stats(&self, client_id: ClientId) -> Option<ClientStats>
Returns statistics for a client.
Sourcepub fn all_client_ids(&self) -> Vec<ClientId> ⓘ
pub fn all_client_ids(&self) -> Vec<ClientId> ⓘ
Returns all client IDs.
Sourcepub fn client_count(&self) -> usize
pub fn client_count(&self) -> usize
Returns the number of registered clients.
Sourcepub fn reset_all_windows(&self)
pub fn reset_all_windows(&self)
Resets all client time windows.
Sourcepub fn aggregate_stats(&self) -> AggregateClientStats
pub fn aggregate_stats(&self) -> AggregateClientStats
Returns aggregate statistics across all clients.
Trait Implementations§
Source§impl Debug for ClientRegistry
impl Debug for ClientRegistry
Auto Trait Implementations§
impl Freeze for ClientRegistry
impl !RefUnwindSafe for ClientRegistry
impl Send for ClientRegistry
impl Sync for ClientRegistry
impl Unpin for ClientRegistry
impl UnsafeUnpin for ClientRegistry
impl UnwindSafe for ClientRegistry
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
Mutably borrows from an owned value. Read more