private void DiskWritePageTable(string tableName, PageTable pt) { string filename = DatabaseName + "." + tableName + ".index"; using (var fileStream = new FileStream(filename, FileMode.OpenOrCreate)) { var pageTable = pt.GetBytes(); fileStream.Seek(0, SeekOrigin.Begin); fileStream.Write(pageTable, 0, pageTable.Length); fileStream.Flush(); } }
//mark everything in this page, so next time we will write all records in this page to a different page private void UpdateShadowIdsForPage(PageTable pageTable, int pageIndex, int shadowId, Guid transactionId) { foreach (var item in pageTable.RecordIndices) { if (item.PageIndex == pageIndex && item.Key[0] != 0) { item.IsDirty = 1; item.ShadowFileId = shadowId; item.TransactionId = transactionId; } } }
private void CreatePageTable(string tableName, int keySize) { string filename = DatabaseName + "." + tableName + ".index"; if (File.Exists(filename)) { return; } var pt = new PageTable(new byte[DefaultPageSize], DefaultPageSize, keySize); DiskWritePageTable(tableName, pt); }
private void CreatePageTable(string tableName, int keySize) { string filename = DatabaseName + "." + tableName + ".index"; if (File.Exists(filename)) return; var pt = new PageTable(new byte[DefaultPageSize], DefaultPageSize, keySize); DiskWritePageTable(tableName, pt); }