Пример #1
0
        public BinaryData GetHeapItem(NID[] nodePath, HID hid)
        {
            var externalBlock = dataTreeReader.Read(nodePath, hid.BlockIndex)[0];

            int pageMapOffset;

            if (hid.BlockIndex == 0)
            {
                var hnHDR = HNHDR.OfValue(externalBlock.Take(12));

                pageMapOffset = hnHDR.PageMapOffset;
            }
            else if (hid.BlockIndex == 8 || (hid.BlockIndex - 8) % 128 == 0)
            {
                var hnBitmapHDR = HNBITMAPHDR.OfValue(externalBlock.Take(66));

                pageMapOffset = hnBitmapHDR.PageMapOffset;
            }
            else
            {
                var hnPageHDR = HNPAGEHDR.OfValue(externalBlock.Take(2));

                pageMapOffset = hnPageHDR.PageMapOffset;
            }

            var pageMap = GetPageMapFromExternalDataBlock(externalBlock, pageMapOffset);

            var items = heapOnNodeItemsLoader.Load(hid.BlockIndex, pageMap, externalBlock);

            return(items[hid]);
        }
Пример #2
0
        private BinaryData EncodeBlockWithNewFillLevel(
            ExternalDataBlockForHeapOnNode block,
            BinaryData fillLevelsForTheNext128Blocks)
        {
            var hnBitmapHeader =
                new HNBITMAPHDR(
                    block.RawByteCountWithoutPageMapWithPadding,
                    fillLevelsForTheNext128Blocks);

            return(EncodeBlock(block, bitmapHeaderEncoder.Encode(hnBitmapHeader)));
        }