unique_ref<DataInnerNode> DataInnerNode::InitializeNewNode(unique_ref<Block> block, const DataNode &first_child) { DataNodeView node(std::move(block)); node.setFormatVersion(DataNode::FORMAT_VERSION_HEADER); node.setDepth(first_child.depth() + 1); node.setSize(1); auto result = make_unique_ref<DataInnerNode>(std::move(node)); result->ChildrenBegin()->setKey(first_child.key()); return result; }
void DataInnerNode::addChild(const DataNode &child) { ASSERT(numChildren() < maxStoreableChildren(), "Adding more children than we can store"); ASSERT(child.depth() == depth()-1, "The child that should be added has wrong depth"); node().setSize(node().Size()+1); LastChild()->setKey(child.key()); }