public static BTreeNode ReadNode(BTree tree, byte[] buffer, int offset) { BTreeNodeDescriptor descriptor = (BTreeNodeDescriptor)Utilities.ToStruct <BTreeNodeDescriptor>(buffer, offset); switch (descriptor.Kind) { case BTreeNodeKind.HeaderNode: return(new BTreeHeaderNode(tree, descriptor)); case BTreeNodeKind.IndexNode: case BTreeNodeKind.LeafNode: throw new NotImplementedException("Attempt to read index/leaf node without key and data types"); default: throw new NotImplementedException("Unrecognized BTree node kind: " + descriptor.Kind); } }
public static BTreeNode ReadNode <TKey>(BTree tree, byte[] buffer, int offset) where TKey : BTreeKey, new() { BTreeNodeDescriptor descriptor = (BTreeNodeDescriptor)Utilities.ToStruct <BTreeNodeDescriptor>(buffer, offset); switch (descriptor.Kind) { case BTreeNodeKind.HeaderNode: return(new BTreeHeaderNode(tree, descriptor)); case BTreeNodeKind.LeafNode: return(new BTreeLeafNode <TKey>(tree, descriptor)); case BTreeNodeKind.IndexNode: return(new BTreeIndexNode <TKey>(tree, descriptor)); default: throw new NotImplementedException("Unrecognized BTree node kind: " + descriptor.Kind); } }
public BTreeNode(BTree tree, BTreeNodeDescriptor descriptor) { _tree = tree; _descriptor = descriptor; }
public BTreeHeaderNode(BTree tree, BTreeNodeDescriptor descriptor) : base(tree, descriptor) { }
public BTreeNode(BTree tree, BTreeNodeDescriptor descriptor) { this.Tree = tree; this.Descriptor = descriptor; }
public BTreeLeafNode(BTree tree, BTreeNodeDescriptor descriptor) : base(tree, descriptor) { }
public BTreeIndexNode(BTree tree, BTreeNodeDescriptor descriptor) : base(tree, descriptor) { }