예제 #1
0
        public byte[] GetLeafValue(BTreeLeaf leaf, Key key)
        {
            var reader = new LeafReader(this, leaf);

            var unpacked = DataConverter.Unpack("^i", reader.Read(4), 0);

            var numKeys = (int)unpacked[0];

            int discarded;

            for (int i = 0; i < numKeys; i++)
            {
                byte[] curKey = reader.Read(KeySize);

                int length = (int)VLQ.ReadVLQ(reader, out discarded);

                byte[] value = reader.Read(length);

                if (curKey.SequenceEqual(key.TheKey))
                {
                    return(value);
                }
            }

            return(null);
        }
예제 #2
0
 public LeafReader(SBBF02 sb, BTreeLeaf leaf)
 {
     File    = sb;
     Leaf    = leaf;
     Offset  = 0;
     Visited = new List <int>(new[] { leaf.Index });
 }