mstar.engine.resources.kv.prefix_index#
The prefix index: which cached page holds which key, and which to drop first.
Inserting makes the index a page’s second owner, so evicting releases that one reference and the page reaches the free list only once no live request holds it too. Leaves are ordered by a clock that ticks on every insert and every matching lookup. A hit re-stamps a page without pushing it again, so a leaf keeps one heap entry however often it is read, and an entry that surfaces under an older stamp is pushed back under the page’s own.
Every caller holds the manager’s lock, so none of this takes one of its own.
Classes
|
- class mstar.engine.resources.kv.prefix_index.PrefixIndex(arena)[source]#
Bases:
object- Parameters:
arena (PageArena)
- evict(n)[source]#
Drop the oldest leaves the index alone holds, until
nare free.A leaf a request or a lease also holds is passed over and put back: dropping it would free nothing and lose an entry that is still good. Returns how many pages reached the free list.