/// <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; }
/// <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]; }
/// <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]; }
/// <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]); }