示例#1
0
        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);
            }
        }
示例#2
0
        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);
            }
        }
示例#3
0
 public BTreeNode(BTree tree, BTreeNodeDescriptor descriptor)
 {
     _tree       = tree;
     _descriptor = descriptor;
 }
示例#4
0
 public BTreeHeaderNode(BTree tree, BTreeNodeDescriptor descriptor)
     : base(tree, descriptor)
 {
 }
示例#5
0
 public BTreeNode(BTree tree, BTreeNodeDescriptor descriptor)
 {
     this.Tree       = tree;
     this.Descriptor = descriptor;
 }
示例#6
0
 public BTreeLeafNode(BTree tree, BTreeNodeDescriptor descriptor)
     : base(tree, descriptor)
 {
 }
示例#7
0
 public BTreeHeaderNode(BTree tree, BTreeNodeDescriptor descriptor)
     : base(tree, descriptor)
 {
 }
示例#8
0
 public BTreeIndexNode(BTree tree, BTreeNodeDescriptor descriptor)
     : base(tree, descriptor)
 {
 }