Skip to main content

Module access_tracker

Module access_tracker 

Source
Expand description

Access frequency and recency tracking for storage tiering and eviction decisions.

AccessTracker maintains per-CID access records and computes a composite score that balances how often a block is accessed (frequency) against how recently it was last accessed (recency). The score drives hot/cold classification and LRU-style eviction.

§Score formula

score = access_count / (1 + time_since_last_access_secs * decay_factor)

Blocks with a score above hot_threshold are classified as hot; blocks below cold_threshold are classified as cold. When the tracker is at capacity, AccessTracker::enforce_capacity evicts the coldest blocks first.

§Example

use ipfrs_storage::access_tracker::{AccessTracker, TrackerConfig};

let config = TrackerConfig::default();
let mut tracker = AccessTracker::new(config);

tracker.record_access("bafybeig", 1024, 0);
tracker.record_access("bafybeig", 1024, 10);

assert!(tracker.is_hot("bafybeig", 10));

Structs§

AccessRecord
A single CID’s access history and computed temperature score.
AccessTracker
Tracks access frequency and recency for storage tiering and eviction.
TrackerConfig
Configuration parameters that govern tracker behaviour.
TrackerStats
Aggregate statistics maintained by the tracker.