|
libaaruformat 1.0
Aaru Data Preservation Suite - Format Library
|
Fixed-size hash map with LRU-like eviction for bounded memory usage. More...
#include <aaruformat/static_lru_hash_map.h>
Data Fields | |
| lru_kv_pair_t * | table |
| Array of key/value slots of length == size. | |
| size_t | size |
| Allocated slot capacity (FIXED at creation). | |
| size_t | count |
| Number of active (filled) entries. | |
| size_t | max_count |
| Eviction trigger threshold (size * EVICTION_LOAD_FACTOR). | |
| size_t | target_count |
| Target count after eviction (size * TARGET_LOAD_FACTOR). | |
| uint32_t | age_counter |
| Operations since last aging. | |
| uint32_t | _padding |
| Padding for alignment. | |
Fixed-size hash map with LRU-like eviction for bounded memory usage.
This map allocates a fixed amount of memory at creation and never grows. When the map approaches capacity (exceeds eviction threshold), it automatically evicts the least-frequently-accessed entries to make room for new insertions.
Fields:
Memory usage: sizeof(static_lru_hash_map_t) + (size * sizeof(lru_kv_pair_t)) With default 24-byte entries: ~24 bytes per entry + 48 bytes for the struct.
Definition at line 97 of file static_lru_hash_map.h.
| uint32_t static_lru_hash_map_t::_padding |
Padding for alignment.
Definition at line 105 of file static_lru_hash_map.h.
Referenced by static_lru_create_map().
| uint32_t static_lru_hash_map_t::age_counter |
Operations since last aging.
Definition at line 104 of file static_lru_hash_map.h.
Referenced by static_lru_age_counts(), static_lru_create_map(), and static_lru_insert_map().
| size_t static_lru_hash_map_t::count |
Number of active (filled) entries.
Definition at line 101 of file static_lru_hash_map.h.
Referenced by evict_lru_entries(), rehash_in_place(), static_lru_create_map(), static_lru_free_slots(), static_lru_insert_map(), and static_lru_load_factor().
| size_t static_lru_hash_map_t::max_count |
Eviction trigger threshold (size * EVICTION_LOAD_FACTOR).
Definition at line 102 of file static_lru_hash_map.h.
Referenced by static_lru_create_map(), and static_lru_insert_map().
| size_t static_lru_hash_map_t::size |
Allocated slot capacity (FIXED at creation).
Definition at line 100 of file static_lru_hash_map.h.
Referenced by age_access_counts(), evict_lru_entries(), rehash_in_place(), static_lru_contains_key(), static_lru_create_map(), static_lru_free_slots(), static_lru_insert_map(), static_lru_load_factor(), and static_lru_lookup_map().
| lru_kv_pair_t* static_lru_hash_map_t::table |
Array of key/value slots of length == size.
Definition at line 99 of file static_lru_hash_map.h.
Referenced by age_access_counts(), evict_lru_entries(), rehash_in_place(), static_lru_contains_key(), static_lru_create_map(), static_lru_free_map(), static_lru_insert_map(), and static_lru_lookup_map().
| size_t static_lru_hash_map_t::target_count |
Target count after eviction (size * TARGET_LOAD_FACTOR).
Definition at line 103 of file static_lru_hash_map.h.
Referenced by evict_lru_entries(), and static_lru_create_map().