pub struct QuotaManager { /* private fields */ }Expand description
Manager for namespace storage quotas
Implementations§
Source§impl QuotaManager
impl QuotaManager
Sourcepub fn with_default(default_config: QuotaConfig) -> Self
pub fn with_default(default_config: QuotaConfig) -> Self
Create a quota manager with a default configuration for new namespaces
Sourcepub fn set_default_config(&self, config: Option<QuotaConfig>)
pub fn set_default_config(&self, config: Option<QuotaConfig>)
Set the default quota configuration for new namespaces
Sourcepub fn get_default_config(&self) -> Option<QuotaConfig>
pub fn get_default_config(&self) -> Option<QuotaConfig>
Get the default quota configuration
Sourcepub fn set_quota(&self, namespace: &NamespaceId, config: QuotaConfig)
pub fn set_quota(&self, namespace: &NamespaceId, config: QuotaConfig)
Set quota configuration for a namespace
Sourcepub fn get_quota(&self, namespace: &NamespaceId) -> Option<QuotaConfig>
pub fn get_quota(&self, namespace: &NamespaceId) -> Option<QuotaConfig>
Get quota configuration for a namespace
Sourcepub fn remove_quota(&self, namespace: &NamespaceId) -> Option<QuotaConfig>
pub fn remove_quota(&self, namespace: &NamespaceId) -> Option<QuotaConfig>
Remove quota configuration for a namespace
Sourcepub fn init_usage(
&self,
namespace: &NamespaceId,
vector_count: u64,
storage_bytes: u64,
)
pub fn init_usage( &self, namespace: &NamespaceId, vector_count: u64, storage_bytes: u64, )
Initialize usage tracking for a namespace
Sourcepub fn get_usage(&self, namespace: &NamespaceId) -> Option<QuotaUsage>
pub fn get_usage(&self, namespace: &NamespaceId) -> Option<QuotaUsage>
Get current usage for a namespace
Sourcepub fn update_usage(
&self,
namespace: &NamespaceId,
vector_count: u64,
storage_bytes: u64,
)
pub fn update_usage( &self, namespace: &NamespaceId, vector_count: u64, storage_bytes: u64, )
Update usage for a namespace
Sourcepub fn increment_usage(
&self,
namespace: &NamespaceId,
added_vectors: u64,
added_bytes: u64,
)
pub fn increment_usage( &self, namespace: &NamespaceId, added_vectors: u64, added_bytes: u64, )
Increment usage after successful upsert
Sourcepub fn decrement_usage(
&self,
namespace: &NamespaceId,
removed_vectors: u64,
removed_bytes: u64,
)
pub fn decrement_usage( &self, namespace: &NamespaceId, removed_vectors: u64, removed_bytes: u64, )
Decrement usage after successful delete
Sourcepub fn remove_usage(&self, namespace: &NamespaceId)
pub fn remove_usage(&self, namespace: &NamespaceId)
Remove usage tracking for a namespace
Sourcepub fn get_status(&self, namespace: &NamespaceId) -> Option<QuotaStatus>
pub fn get_status(&self, namespace: &NamespaceId) -> Option<QuotaStatus>
Get full quota status for a namespace
Sourcepub fn get_all_status(&self) -> Vec<QuotaStatus>
pub fn get_all_status(&self) -> Vec<QuotaStatus>
Get quota status for all namespaces
Sourcepub fn estimate_storage_size(vectors: &[Vector]) -> u64
pub fn estimate_storage_size(vectors: &[Vector]) -> u64
Estimate storage size for vectors
Sourcepub fn check_upsert(
&self,
namespace: &NamespaceId,
vectors: &[Vector],
) -> QuotaCheckResult
pub fn check_upsert( &self, namespace: &NamespaceId, vectors: &[Vector], ) -> QuotaCheckResult
Check if an upsert operation would exceed quotas
Sourcepub fn enforce_upsert(
&self,
namespace: &NamespaceId,
vectors: &[Vector],
) -> Result<()>
pub fn enforce_upsert( &self, namespace: &NamespaceId, vectors: &[Vector], ) -> Result<()>
Check quota and return error if exceeded (for use in upsert operations)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for QuotaManager
impl !RefUnwindSafe for QuotaManager
impl Send for QuotaManager
impl Sync for QuotaManager
impl Unpin for QuotaManager
impl UnsafeUnpin 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
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>
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>
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