Skip to main content

TierConfig

Struct TierConfig 

Source
pub struct TierConfig {
    pub name: String,
    pub capacity_bytes: usize,
    pub access_latency_us: u64,
    pub eviction_policy: EvictionPolicy,
    pub disk_path: Option<PathBuf>,
    pub promotion_threshold: u64,
    pub compress: bool,
}
Expand description

Configuration for one tier.

Fields§

§name: String

Human-readable name (e.g. "L1", "L2", "disk").

§capacity_bytes: usize

Maximum number of bytes this tier may hold.

§access_latency_us: u64

Simulated read latency in microseconds (used in future work / profiling).

§eviction_policy: EvictionPolicy

How entries are selected for eviction when the tier is full.

§disk_path: Option<PathBuf>

Optional path to a directory on disk for file-backed storage.

When Some(path), entries evicted from this tier are stored as individual files under path/<key_hash>. Memory entries act as an in-memory index; disk is the actual backing store.

§promotion_threshold: u64

Minimum access frequency before a hit in this tier promotes the entry to the previous (hotter) tier.

A value of 0 means “always promote” (original behaviour). A value of 3 means the key must have been accessed at least 3 times in this tier before it is considered hot enough to move up.

§compress: bool

Whether to compress entry bytes in this tier.

When true, values are compressed with a simple run-length encoder before being stored and decoded on retrieval. Useful for L2+ tiers to reduce memory / disk footprint.

Implementations§

Source§

impl TierConfig

Source

pub fn memory(name: impl Into<String>, capacity_bytes: usize) -> Self

Create a minimal in-memory tier config with default values.

Source

pub fn disk( name: impl Into<String>, capacity_bytes: usize, path: impl Into<PathBuf>, ) -> Self

Create a disk-backed tier config.

Trait Implementations§

Source§

impl Clone for TierConfig

Source§

fn clone(&self) -> TierConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TierConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.