pub struct TenantManager { /* private fields */ }Expand description
Central tenant management system
Implementations§
Source§impl TenantManager
impl TenantManager
pub fn new() -> Self
Sourcepub async fn create_tenant(
&self,
tenant_id: TenantId,
name: String,
config: Option<TenantConfig>,
) -> Result<TenantInfo>
pub async fn create_tenant( &self, tenant_id: TenantId, name: String, config: Option<TenantConfig>, ) -> Result<TenantInfo>
Create a new tenant
Sourcepub fn get_tenant(&self, tenant_id: &TenantId) -> Result<TenantInfo>
pub fn get_tenant(&self, tenant_id: &TenantId) -> Result<TenantInfo>
Get tenant information
Sourcepub fn list_tenants(
&self,
status_filter: Option<TenantStatus>,
) -> Vec<TenantInfo>
pub fn list_tenants( &self, status_filter: Option<TenantStatus>, ) -> Vec<TenantInfo>
List all tenants with optional filtering
Sourcepub fn update_tenant(
&self,
tenant_id: &TenantId,
updates: TenantUpdate,
) -> Result<TenantInfo>
pub fn update_tenant( &self, tenant_id: &TenantId, updates: TenantUpdate, ) -> Result<TenantInfo>
Update tenant configuration
Sourcepub fn delete_tenant(&self, tenant_id: &TenantId) -> Result<()>
pub fn delete_tenant(&self, tenant_id: &TenantId) -> Result<()>
Delete a tenant (marks for deletion)
Sourcepub fn get_tenant_usage(&self, tenant_id: &TenantId) -> Result<ResourceUsage>
pub fn get_tenant_usage(&self, tenant_id: &TenantId) -> Result<ResourceUsage>
Get resource usage for a tenant
Sourcepub fn check_tenant_quota(
&self,
tenant_id: &TenantId,
resource_type: ResourceType,
amount: u64,
) -> Result<()>
pub fn check_tenant_quota( &self, tenant_id: &TenantId, resource_type: ResourceType, amount: u64, ) -> Result<()>
Check if tenant can perform operation
Sourcepub fn record_tenant_usage(
&self,
tenant_id: &TenantId,
resource_type: ResourceType,
amount: u64,
) -> Result<()>
pub fn record_tenant_usage( &self, tenant_id: &TenantId, resource_type: ResourceType, amount: u64, ) -> Result<()>
Record resource usage for a tenant
Sourcepub fn get_tenants_near_limits(&self) -> Vec<(TenantId, ResourceUsage)>
pub fn get_tenants_near_limits(&self) -> Vec<(TenantId, ResourceUsage)>
Get tenants that are near their resource limits
Sourcepub fn get_isolation_metrics(&self) -> IsolationMetrics
pub fn get_isolation_metrics(&self) -> IsolationMetrics
Get isolation metrics
Trait Implementations§
Source§impl Default for TenantManager
impl Default for TenantManager
Source§impl TenantOperations for TenantManager
impl TenantOperations for TenantManager
fn create_tenant<'life0, 'async_trait>(
&'life0 self,
tenant_id: TenantId,
name: String,
config: Option<TenantConfig>,
) -> Pin<Box<dyn Future<Output = Result<TenantInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_tenant<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant_id: &'life1 TenantId,
) -> Pin<Box<dyn Future<Output = Result<TenantInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_tenant<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant_id: &'life1 TenantId,
updates: TenantUpdate,
) -> Pin<Box<dyn Future<Output = Result<TenantInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_tenant<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant_id: &'life1 TenantId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_tenants<'life0, 'async_trait>(
&'life0 self,
status_filter: Option<TenantStatus>,
) -> Pin<Box<dyn Future<Output = Result<Vec<TenantInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl Freeze for TenantManager
impl RefUnwindSafe for TenantManager
impl Send for TenantManager
impl Sync for TenantManager
impl Unpin for TenantManager
impl UnwindSafe for TenantManager
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
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 more