pub struct QuotaManager { /* private fields */ }Expand description
Quota Manager
Manages per-tenant storage quotas with enforcement
Implementations§
Source§impl QuotaManager
impl QuotaManager
Sourcepub fn new(config: QuotaManagerConfig) -> Self
pub fn new(config: QuotaManagerConfig) -> Self
Create a new quota manager
Sourcepub fn set_quota(&self, tenant_id: TenantId, config: QuotaConfig)
pub fn set_quota(&self, tenant_id: TenantId, config: QuotaConfig)
Set quota for a tenant
Sourcepub fn get_quota(&self, tenant_id: &str) -> Option<QuotaConfig>
pub fn get_quota(&self, tenant_id: &str) -> Option<QuotaConfig>
Get quota configuration for a tenant
Sourcepub fn get_usage(&self, tenant_id: &str) -> Option<QuotaUsageSnapshot>
pub fn get_usage(&self, tenant_id: &str) -> Option<QuotaUsageSnapshot>
Get quota usage for a tenant
Sourcepub fn check_write_quota(
&self,
tenant_id: &str,
data_size: u64,
) -> Result<QuotaStatus, ViolationType>
pub fn check_write_quota( &self, tenant_id: &str, data_size: u64, ) -> Result<QuotaStatus, ViolationType>
Check if a write operation is allowed
Sourcepub fn check_read_quota(
&self,
tenant_id: &str,
data_size: u64,
) -> Result<QuotaStatus, ViolationType>
pub fn check_read_quota( &self, tenant_id: &str, data_size: u64, ) -> Result<QuotaStatus, ViolationType>
Check if a read operation is allowed
Sourcepub fn record_write(&self, tenant_id: &str, cid: Cid, data_size: u64)
pub fn record_write(&self, tenant_id: &str, cid: Cid, data_size: u64)
Record a write operation
Sourcepub fn record_read(&self, tenant_id: &str, data_size: u64)
pub fn record_read(&self, tenant_id: &str, data_size: u64)
Record a read operation
Sourcepub fn record_delete(&self, cid: &Cid)
pub fn record_delete(&self, cid: &Cid)
Record a delete operation
Sourcepub fn list_tenants(&self) -> Vec<TenantId> ⓘ
pub fn list_tenants(&self) -> Vec<TenantId> ⓘ
Get all tenants
Sourcepub fn get_quota_report(&self, tenant_id: &str) -> Option<QuotaReport>
pub fn get_quota_report(&self, tenant_id: &str) -> Option<QuotaReport>
Get quota report for a tenant
Auto Trait Implementations§
impl !Freeze for QuotaManager
impl !RefUnwindSafe for QuotaManager
impl Send for QuotaManager
impl Sync for QuotaManager
impl Unpin for QuotaManager
impl UnwindSafe for QuotaManager
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