pub struct BlockManagerConfigBuilder<T: BlockMetadata> { /* private fields */ }Expand description
Builder for BlockManager configuration.
Construct via BlockManager::builder() and finish with build().
Implementations§
Source§impl<T: BlockMetadata> BlockManagerConfigBuilder<T>
impl<T: BlockMetadata> BlockManagerConfigBuilder<T>
Sourcepub fn block_count(self, count: usize) -> Self
pub fn block_count(self, count: usize) -> Self
Set the number of blocks in the pool.
Sourcepub fn block_size(self, size: usize) -> Self
pub fn block_size(self, size: usize) -> Self
Sourcepub fn duplication_policy(self, policy: BlockDuplicationPolicy) -> Self
pub fn duplication_policy(self, policy: BlockDuplicationPolicy) -> Self
Set the duplication policy.
Sourcepub fn registry(self, registry: BlockRegistry) -> Self
pub fn registry(self, registry: BlockRegistry) -> Self
Set the block registry.
Sourcepub fn with_lru_backend(self) -> Self
pub fn with_lru_backend(self) -> Self
Use simple LRU backend (capacity automatically set to block_count).
Sourcepub fn with_multi_lru_backend(self) -> Self
pub fn with_multi_lru_backend(self) -> Self
Use multi-level LRU backend with 4 fixed priority levels.
Default thresholds: [3, 8, 15] for transitions between:
Cold (0-2 hits) -> Warm (3-7) -> Hot (8-14) -> Very Hot (15+).
Sourcepub fn with_multi_lru_backend_custom_thresholds(
self,
cold_to_warm: u8,
warm_to_hot: u8,
hot_to_very_hot: u8,
) -> Self
pub fn with_multi_lru_backend_custom_thresholds( self, cold_to_warm: u8, warm_to_hot: u8, hot_to_very_hot: u8, ) -> Self
Use multi-level LRU with custom frequency thresholds.
§Requirements
- Thresholds must be in ascending order: cold_to_warm < warm_to_hot < hot_to_very_hot
- hot_to_very_hot must be <= 15 (4-bit counter maximum)
- cold_to_warm must be >= 1 (to distinguish from never-accessed blocks)
§Arguments
cold_to_warm- Minimum frequency to move from Cold to Warm levelwarm_to_hot- Minimum frequency to move from Warm to Hot levelhot_to_very_hot- Minimum frequency to move from Hot to Very Hot level
§Panics
Panics if thresholds don’t meet the requirements above.
Sourcepub fn with_hashmap_backend(self) -> Self
pub fn with_hashmap_backend(self) -> Self
Use HashMap backend with FIFO reuse order.
Sourcepub fn with_lineage_backend(self) -> Self
pub fn with_lineage_backend(self) -> Self
Use the lineage backend with the default (Tick)
leaf-eviction policy.
Sourcepub fn with_lineage_backend_eviction(self, eviction: LineageEviction) -> Self
pub fn with_lineage_backend_eviction(self, eviction: LineageEviction) -> Self
Use the lineage backend with an explicit leaf-eviction policy.
Sourcepub fn aggregator(self, aggregator: MetricsAggregator) -> Self
pub fn aggregator(self, aggregator: MetricsAggregator) -> Self
Set a metrics aggregator for prometheus export.
The aggregator will automatically receive this manager’s metrics source.
Sourcepub fn with_default_reset_on_release(self, value: bool) -> Self
pub fn with_default_reset_on_release(self, value: bool) -> Self
Set the default value of the per-block reset_on_release flag.
When true, every ImmutableBlock constructed by this manager
starts with the flag set. On its last drop, the slot bypasses
the inactive pool and is reset back to the free list directly
(matching release_duplicate semantics for primary releases).
Individual blocks can still override via
crate::blocks::ImmutableBlock::set_evict_on_reset.
Default: false.
Sourcepub fn build(self) -> Result<BlockManager<T>, BlockManagerBuilderError>
pub fn build(self) -> Result<BlockManager<T>, BlockManagerBuilderError>
Build the BlockManager.
Validates configuration and constructs all pools, the upgrade closure, and the metrics source. Returns an error if validation fails or backend construction fails.