Пример #1
0
        private BPlusTreeNode <TKeyType> ReadNode(uint pointerValue)
        {
            if (NodeCache.ContainsKey(pointerValue))
            {
                return(NodeCache[pointerValue]);
            }

            Pointer pointer = new Pointer(pointerValue);

            Block block = MemoryManager.Read(IndexRelation, pointer);

            return(GetNodeFromBlock(pointer, block));
        }
Пример #2
0
 private void FindAllNodes(Node <TNodeKey> node, Dictionary <Int64, Node <TNodeKey> > acc, int depth = 0)
 {
     if (depth > 64)
     {
         throw new InvalidOperationException("Panic, a btree node is linked self or one of its parents");
     }
     foreach (var childNodeAddress in node.ChildrenAddresses.Addresses)
     {
         if (NodeCache.ContainsKey(childNodeAddress))
         {
             var childNode = NodeCache[childNodeAddress];
             acc[childNodeAddress] = childNode;
             FindAllNodes(childNode, acc, depth + 1);
         }
     }
 }