Example #1
0
        public virtual void Insert(IComparable key, object value)
        {
            if (_root.IsFull())
            {
                var newRoot = BuildNode();
                var oldRoot = _root;

                newRoot.SetChildAt(_root, 0);
                newRoot.SetNbChildren(1);

                _root = newRoot;

                Split(newRoot, oldRoot, 0);

                _height++;
                _persister.SaveNode(oldRoot);

                // TODO Remove the save of the new root : the save on the btree
                // should do the save on the new root(after introspector
                // refactoring)
                _persister.SaveNode(newRoot);
                _persister.SaveBTree(this);

                BTreeValidator.ValidateNode(newRoot, true);
            }
            InsertNonFull(_root, key, value);
            _size++;
            _persister.SaveBTree(this);
        }