Expand description
Enhanced temporal scoring with EMA + popcount + recency, hysteresis, and budgeted maintenance (ADR-020).
§Scoring Formula
score = w_ema * ema_rate
+ w_pop * (popcount(access_window) / 64)
+ w_rec * exp(-dt / tau)Where dt = now - last_access and tau is the recency decay constant.
§Hysteresis
To prevent tier oscillation, upgrades require the score to exceed the threshold by the hysteresis margin, and downgrades require the score to fall below the threshold by the same margin. A minimum residency period further dampens churn.
§Types
The types BlockKey, BlockMeta, and Tier are defined here for
self-containment while store.rs is developed in parallel. Once
crate::store lands, replace these definitions with:
ⓘ
use crate::store::{BlockKey, BlockMeta, Tier};Structs§
- Block
Key - Opaque block identifier.
- Block
Meta - Per-block metadata tracked by the tiered store.
- Maintenance
Result - Result of a maintenance tick operation.
- Migration
Candidate - Candidate for tier migration during maintenance.
- Scored
Partition - Result of scoring and partitioning blocks into tier buckets.
- Tier
Config - Enhanced tier policy with EMA + popcount + recency scoring.
Enums§
- Tier
- Storage tier for a block.
Functions§
- bits_
for_ tier - Get the quantization bit width for a tier.
- choose_
tier - Choose the target tier for a block, applying hysteresis and residency.
- choose_
tiers_ batch - Compute tier decisions for many blocks at once.
- compute_
score - Compute the composite score for a block.
- compute_
scores_ batch - Compute scores for many blocks at once.
- score_
and_ partition - Score blocks and partition into hot/warm/cold/evict buckets based on raw score thresholds.
- select_
candidates - Select blocks that need tier migration.
- tick_
decay - Decay EMA for blocks not accessed in the current tick.
- top_
k_ coldest - Find the
kblocks with the lowest scores (useful for eviction). - touch
- Record an access event on a block’s metadata.