Skip to content

b+tree: move and shift a node's whole entry, not just its key - #156

Open
psiha wants to merge 1 commit into
bt/3-node-boundsfrom
bt/4-entry-mover
Open

b+tree: move and shift a node's whole entry, not just its key#156
psiha wants to merge 1 commit into
bt/3-node-boundsfrom
bt/4-entry-mover

Conversation

@psiha

@psiha psiha commented Sep 9, 2026

Copy link
Copy Markdown
Owner

Every site that relocates values inside or between nodes named the key array directly — move_keys, rshift_keys/lshift_keys, and nine raw std::shift_left/shift_right calls on node.keys. That is the same thing as assuming an entry is a key, which holds only for a set.

The three helpers now carry whatever arrays make up an entry, keyed off the node type: a map's leaf has a parallel array of mapped values that has to move by the same indices, in the same direction, at the same time. Child slots are deliberately not part of an entry — relocating those has to re-index and dirty every child touched, which is what move_chldrn is for.

No behavioural change: with no node carrying values yet, every added branch is constant-false and compiles away.

Stacked on #155.

Every site that relocates values inside or between nodes named the key array
directly - move_keys, rshift_keys/lshift_keys, and nine raw std::shift_left/
right calls on node.keys.  That is the same thing as assuming an entry IS a
key, which holds only for a set.

The three helpers now carry whatever arrays make up an entry, keyed off the
node type: a map's leaf has a parallel array of mapped values that has to move
by the same indices, in the same direction, at the same time.  Child slots are
deliberately not part of an entry - relocating those has to re-index and dirty
every child touched, which is what move_chldrn is for.

No behavioural change: with no node carrying values yet, every added branch is
constant-false and compiles away.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant