Skip to main content

Module tiering

Module tiering 

Source
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§

BlockKey
Opaque block identifier.
BlockMeta
Per-block metadata tracked by the tiered store.
MaintenanceResult
Result of a maintenance tick operation.
MigrationCandidate
Candidate for tier migration during maintenance.
ScoredPartition
Result of scoring and partitioning blocks into tier buckets.
TierConfig
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 k blocks with the lowest scores (useful for eviction).
touch
Record an access event on a block’s metadata.