pub struct TagHints { /* private fields */ }Expand description
The per-keyspace append hints for one handle.
D9 widened the append SPLIT from “rightmost leaf of the tree” to “rightmost leaf of the key’s own tag”. This widens the append HINT the same way, which is the other half: the split policy was already right for a tag that is not the tree’s last, but every one of those inserts still paid a full root-to-leaf descent to reach the leaf the policy then acted on.
WHY A CACHED FENCE IS SAFE. fast_path_leaf’s next_leaf() == 0 test is
self-validating – it reads the truth off the page every time – and a
cached separator is not. It is exact only while the tree’s shape is the one
the arming descent walked, so every way that shape can move is answered:
- a split of the hinted leaf subdivides its interval – the cached
next_leafchanges, so the page-side check catches it, and the split path forgets the slot as well; - a neighbour redistribution moves separators BETWEEN siblings without touching the chain, so it forgets the slots of every page in its window itself;
- a delete, a graft, a bulk pack, a rollback and a checkpoint can merge leaves, collapse the root or hand a page back to the allocator, and each of those clears the whole cache.
SACRIFICE (Law 4): about 1.5 KB of fixed state per handle, and a linear scan of sixteen slots per insert. Bought: an ascending run that is not the tree’s rightmost – which is every run but one, in a store where D4 makes every feature a tag in the same tree – inserts with one page access instead of the tree’s full height.
Implementations§
Source§impl TagHints
impl TagHints
Sourcepub fn clear(&self)
pub fn clear(&self)
Forget everything. The answer to every structural change this cache does not track page by page.
Sourcepub fn clear_tree(&self, tree: u16)
pub fn clear_tree(&self, tree: u16)
Forget one tree’s slots, for a tree whose root is being freed or whose handle slot is being recycled.
Sourcepub fn attempts(&self) -> u64
pub fn attempts(&self) -> u64
Diagnostics: inserts that found a slot, and inserts that then landed on its leaf. Counted, not reasoned about – the budget tests read these.
pub fn hits(&self) -> u64
Sourcepub fn set_enabled(&self, on: bool)
pub fn set_enabled(&self, on: bool)
Turn the cache on or off for this handle. Turning it off forgets everything it held, so a handle cannot come back to a stale fence.