pub struct TenantRegistry { /* private fields */ }Expand description
Registry for managing tenants.
Implementations§
Source§impl TenantRegistry
impl TenantRegistry
Sourcepub fn new() -> TenantRegistry
pub fn new() -> TenantRegistry
Create a new tenant registry.
Sourcepub fn with_default_quota(self, quota: ResourceQuota) -> TenantRegistry
pub fn with_default_quota(self, quota: ResourceQuota) -> TenantRegistry
Set default quota for new tenants.
Sourcepub fn with_window_duration(self, duration: Duration) -> TenantRegistry
pub fn with_window_duration(self, duration: Duration) -> TenantRegistry
Set rate limit window duration.
Sourcepub fn with_tenant(
self,
tenant_id: impl Into<String>,
quota: ResourceQuota,
) -> TenantRegistry
pub fn with_tenant( self, tenant_id: impl Into<String>, quota: ResourceQuota, ) -> TenantRegistry
Register a tenant with quota.
Sourcepub fn register_tenant(
&self,
tenant_id: impl Into<String>,
quota: ResourceQuota,
) -> Result<(), TenantError>
pub fn register_tenant( &self, tenant_id: impl Into<String>, quota: ResourceQuota, ) -> Result<(), TenantError>
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) -> Result<(), TenantError>
pub fn suspend_tenant(&self, tenant_id: &str) -> Result<(), TenantError>
Suspend a tenant. Suspended tenants cannot allocate resources or send messages.
Sourcepub fn resume_tenant(&self, tenant_id: &str) -> Result<(), TenantError>
pub fn resume_tenant(&self, tenant_id: &str) -> Result<(), TenantError>
Resume a previously suspended tenant.
Sourcepub fn try_allocate_kernel(&self, tenant_id: &str) -> Result<(), TenantError>
pub fn try_allocate_kernel(&self, tenant_id: &str) -> Result<(), TenantError>
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,
) -> Result<(), TenantError>
pub fn try_allocate_gpu_memory( &self, tenant_id: &str, mb: u64, ) -> Result<(), TenantError>
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) -> Result<(), TenantError>
pub fn record_message(&self, tenant_id: &str) -> Result<(), TenantError>
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§
Source§impl Default for TenantRegistry
impl Default for TenantRegistry
Source§fn default() -> TenantRegistry
fn default() -> TenantRegistry
Returns the “default value” for a type. Read more
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> 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>
Converts
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>
Converts
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 moreSource§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.