pub struct TenantRegistry { /* private fields */ }Expand description
Registry for managing tenants.
Implementations§
Source§impl TenantRegistry
impl TenantRegistry
Sourcepub fn with_default_quota(self, quota: ResourceQuota) -> Self
pub fn with_default_quota(self, quota: ResourceQuota) -> Self
Set default quota for new tenants.
Sourcepub fn with_window_duration(self, duration: Duration) -> Self
pub fn with_window_duration(self, duration: Duration) -> Self
Set rate limit window duration.
Sourcepub fn with_tenant(
self,
tenant_id: impl Into<String>,
quota: ResourceQuota,
) -> Self
pub fn with_tenant( self, tenant_id: impl Into<String>, quota: ResourceQuota, ) -> Self
Register a tenant with quota.
Sourcepub fn register_tenant(
&self,
tenant_id: impl Into<String>,
quota: ResourceQuota,
) -> TenantResult<()>
pub fn register_tenant( &self, tenant_id: impl Into<String>, quota: ResourceQuota, ) -> TenantResult<()>
Register a new tenant.
Sourcepub fn get_quota(&self, tenant_id: &str) -> Option<ResourceQuota>
pub fn get_quota(&self, tenant_id: &str) -> Option<ResourceQuota>
Get a tenant’s quota.
Sourcepub fn get_usage(&self, tenant_id: &str) -> Option<ResourceUsage>
pub fn get_usage(&self, tenant_id: &str) -> Option<ResourceUsage>
Get a tenant’s current usage.
Sourcepub fn tenant_exists(&self, tenant_id: &str) -> bool
pub fn tenant_exists(&self, tenant_id: &str) -> bool
Check if tenant exists.
Sourcepub fn is_tenant_active(&self, tenant_id: &str) -> bool
pub fn is_tenant_active(&self, tenant_id: &str) -> bool
Check if tenant is active.
Sourcepub fn suspend_tenant(&self, tenant_id: &str) -> TenantResult<()>
pub fn suspend_tenant(&self, tenant_id: &str) -> TenantResult<()>
Suspend a tenant.
Sourcepub fn try_allocate_kernel(&self, tenant_id: &str) -> TenantResult<()>
pub fn try_allocate_kernel(&self, tenant_id: &str) -> TenantResult<()>
Check and increment kernel count.
Sourcepub fn release_kernel(&self, tenant_id: &str)
pub fn release_kernel(&self, tenant_id: &str)
Release a kernel allocation.
Sourcepub fn try_allocate_gpu_memory(
&self,
tenant_id: &str,
mb: u64,
) -> TenantResult<()>
pub fn try_allocate_gpu_memory( &self, tenant_id: &str, mb: u64, ) -> TenantResult<()>
Check and increment GPU memory.
Sourcepub fn release_gpu_memory(&self, tenant_id: &str, mb: u64)
pub fn release_gpu_memory(&self, tenant_id: &str, mb: u64)
Release GPU memory allocation.
Sourcepub fn record_message(&self, tenant_id: &str) -> TenantResult<()>
pub fn record_message(&self, tenant_id: &str) -> TenantResult<()>
Record a message sent.
Sourcepub fn get_utilization(&self, tenant_id: &str) -> Option<QuotaUtilization>
pub fn get_utilization(&self, tenant_id: &str) -> Option<QuotaUtilization>
Get utilization for a tenant.
Sourcepub fn tenant_ids(&self) -> Vec<String>
pub fn tenant_ids(&self) -> Vec<String>
Get all tenant IDs.
Sourcepub fn tenant_count(&self) -> usize
pub fn tenant_count(&self) -> usize
Get tenant count.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for TenantRegistry
impl !RefUnwindSafe for TenantRegistry
impl Send for TenantRegistry
impl Sync for TenantRegistry
impl Unpin for TenantRegistry
impl !UnwindSafe for TenantRegistry
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.