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,
pub adaptive_promotion: bool,
pub use_arena: bool,
}Expand description
Configuration for one tier.
Fields§
§name: StringHuman-readable name (e.g. "L1", "L2", "disk").
capacity_bytes: usizeMaximum number of bytes this tier may hold.
access_latency_us: u64Simulated read latency in microseconds (used in future work / profiling).
eviction_policy: EvictionPolicyHow 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: u64Minimum 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: boolWhether 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.
adaptive_promotion: boolWhether to use a P² quantile estimator to auto-tune the promotion
threshold. When true, the static promotion_threshold acts as a
fallback during warmup (first 5 observations); afterwards the 75th
percentile of observed per-key access frequencies is used.
use_arena: boolWhen true, tier entry bytes are stored in a BumpArena and the
HashMap keeps lightweight (offset, len) handles instead of owned
Vec<u8>. Falls back to owned storage when false (default).
Implementations§
Source§impl TierConfig
impl TierConfig
Sourcepub fn memory(name: impl Into<String>, capacity_bytes: usize) -> Self
pub fn memory(name: impl Into<String>, capacity_bytes: usize) -> Self
Create a minimal in-memory tier config with default values.
Sourcepub fn disk(
name: impl Into<String>,
capacity_bytes: usize,
path: impl Into<PathBuf>,
) -> Self
pub fn disk( name: impl Into<String>, capacity_bytes: usize, path: impl Into<PathBuf>, ) -> Self
Create a disk-backed tier config.
Sourcepub fn enable_adaptive_promotion(self, enabled: bool) -> Self
pub fn enable_adaptive_promotion(self, enabled: bool) -> Self
Enable or disable P²-adaptive promotion threshold tuning.
Sourcepub fn enable_arena(self, enabled: bool) -> Self
pub fn enable_arena(self, enabled: bool) -> Self
Enable or disable arena allocation for tier entries.
Trait Implementations§
Source§impl Clone for TierConfig
impl Clone for TierConfig
Source§fn clone(&self) -> TierConfig
fn clone(&self) -> TierConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more