pub struct QuotaManager { /* private fields */ }Expand description
Manages storage quota using Sled
Implementations§
Source§impl QuotaManager
impl QuotaManager
Sourcepub fn open<P: AsRef<Path>>(path: P) -> StorageResult<Self>
pub fn open<P: AsRef<Path>>(path: P) -> StorageResult<Self>
Open or create a quota manager
Sourcepub fn get_quota(&self) -> StorageResult<StorageQuota>
pub fn get_quota(&self) -> StorageResult<StorageQuota>
Get current quota and usage statistics
Sourcepub fn set_quota_limit(&self, limit: u64) -> StorageResult<()>
pub fn set_quota_limit(&self, limit: u64) -> StorageResult<()>
Set quota limit in bytes (0 = unlimited)
Sourcepub fn add_usage(&self, bytes: u64) -> StorageResult<()>
pub fn add_usage(&self, bytes: u64) -> StorageResult<()>
Add storage usage (when storing a new chunk)
Sourcepub fn remove_usage(&self, bytes: u64) -> StorageResult<()>
pub fn remove_usage(&self, bytes: u64) -> StorageResult<()>
Remove storage usage (when deleting a chunk)
Sourcepub fn can_store(&self, bytes: u64) -> StorageResult<bool>
pub fn can_store(&self, bytes: u64) -> StorageResult<bool>
Check if we can store additional bytes
Sourcepub fn get_stats(&self) -> StorageResult<QuotaStats>
pub fn get_stats(&self) -> StorageResult<QuotaStats>
Get usage statistics
Sourcepub fn reset(&self) -> StorageResult<()>
pub fn reset(&self) -> StorageResult<()>
Reset all usage statistics (dangerous!)
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