Esempio n. 1
0
        /// <summary>
        /// Read all data from datafile using a pageID as reference. If data is not in DataPage, read from ExtendPage.
        /// </summary>
        public byte[] Read(PageAddress blockAddress)
        {
            var block = this.GetBlock(blockAddress);

            // if there is a extend page, read bytes all bytes from extended pages
            if (block.ExtendPageID != uint.MaxValue)
            {
                return this.ReadExtendData(block.ExtendPageID);
            }

            return block.Data;
        }
Esempio n. 2
0
 /// <summary>
 /// Get a node inside a page using PageAddress - Returns null if address IsEmpty
 /// </summary>
 public IndexNode GetNode(PageAddress address)
 {
     if (address.IsEmpty) return null;
     var page = _pager.GetPage<IndexPage>(address.PageID);
     return page.Nodes[address.Index];
 }
Esempio n. 3
0
 /// <summary>
 /// Get a data block from a DataPage using address
 /// </summary>
 public DataBlock GetBlock(PageAddress blockAddress)
 {
     var page = _pager.GetPage<DataPage>(blockAddress.PageID);
     return page.DataBlocks[blockAddress.Index];
 }
Esempio n. 4
0
        /// <summary>
        /// Get a data block from a DataPage using address
        /// </summary>
        public DataBlock GetBlock(PageAddress blockAddress)
        {
            var page = _pager.GetPage <DataPage>(blockAddress.PageID);

            return(page.DataBlocks[blockAddress.Index]);
        }