pub struct Partition {
pub id: String,
pub priority: Priority,
pub min_size: usize,
pub max_size: usize,
pub current_size: usize,
pub tenant_id: Option<String>,
}Expand description
Cache partition definition
Fields§
§id: StringPartition ID
priority: PriorityPriority level
min_size: usizeMinimum guaranteed size (bytes)
max_size: usizeMaximum size limit (bytes)
current_size: usizeCurrent size (bytes)
tenant_id: Option<String>Tenant ID (for multi-tenancy)
Implementations§
Source§impl Partition
impl Partition
Sourcepub fn new(
id: String,
priority: Priority,
min_size: usize,
max_size: usize,
) -> Self
pub fn new( id: String, priority: Priority, min_size: usize, max_size: usize, ) -> Self
Create new partition
Sourcepub fn with_tenant(self, tenant_id: String) -> Self
pub fn with_tenant(self, tenant_id: String) -> Self
Set tenant ID
Sourcepub fn available_space(&self) -> usize
pub fn available_space(&self) -> usize
Get available space
Sourcepub fn utilization(&self) -> f64
pub fn utilization(&self) -> f64
Get utilization percentage
Sourcepub fn under_minimum(&self) -> bool
pub fn under_minimum(&self) -> bool
Check if partition is under minimum guarantee
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Partition
impl RefUnwindSafe for Partition
impl Send for Partition
impl Sync for Partition
impl Unpin for Partition
impl UnsafeUnpin for Partition
impl UnwindSafe for Partition
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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