MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / indexShift

Method indexShift

source/core/StarBTreeDatabase.cpp:554–569  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

552}
553
554bool BTreeDatabase::BTreeImpl::indexShift(Index const& left, Key const& mid, Index const& right) {
555 if (left->pointerCount() + right->pointerCount() <= parent->maxIndexPointers()) {
556 left->shiftLeft(mid, *right, right->pointerCount());
557 return true;
558 } else {
559 if (indexNeedsShift(right)) {
560 right->shiftRight(mid, *left, 1);
561 return true;
562 } else if (indexNeedsShift(left)) {
563 left->shiftLeft(mid, *right, 1);
564 return true;
565 } else {
566 return false;
567 }
568 }
569}
570
571auto BTreeDatabase::BTreeImpl::indexSplit(Index const& index) -> Maybe<pair<Key, Index>> {
572 if (index->pointerCount() <= parent->maxIndexPointers())

Callers

nothing calls this directly

Calls 4

maxIndexPointersMethod · 0.80
pointerCountMethod · 0.45
shiftLeftMethod · 0.45
shiftRightMethod · 0.45

Tested by

no test coverage detected