private static void FlushRecordSetSafe3(RecordSet Data) { //Console.WriteLine(">>>>>>>>>>>>>>>>>>>>>>> DISK_HIT_EXTENT: {0}", Data.Name); // Check if attached // if (Data.IsAttached == false) throw new Exception("BinarySerializer.FlushRecordSet: RecordSet passed is not attached"); // Update the header // Data.Update(); // Estimate the size // int size = EstimateSize(Data); // Memory stack // byte[] memory = new byte[size]; // Write the data to memory // int location = BinarySerializer.WriteRecordSetSafe3(memory, 0, Data); // Create a file stream // using (FileStream fs = File.Create(Data.Header.Path, size)) { fs.Write(memory, 0, location); } // Increment writes // _DISK_WRITES++; }
private static int WriteRecordSetSafe3(byte[] Mem, int Location, RecordSet Data) { /* * Write: * Header * Schema * SortKey * Record Collection */ // Update the data // Data.Update(); // Write header // Location = BinarySerializer.WriteRecordSafe3(Mem, Location, Data.Header); // Write columns // Location = BinarySerializer.WriteRecordsSafe3(Mem, Location, Data.Columns._Cache); // Write sort key // Location = BinarySerializer.WriteRecordSafe3(Mem, Location, Data.SortBy.ToRecord()); // Write cache // Location = BinarySerializer.WriteRecordsSafe3(Mem, Location, Data._Cache); return Location; }
private static void FlushRecordSetSafe(RecordSet Data) { //Console.WriteLine(">>>>>>>>>>>>>>>>>>>>>>> DISK_HIT_EXTENT: {0}", Data.Name); // Check if attached // if (Data.IsAttached == false) throw new Exception("BinarySerializer.FlushRecordSet: RecordSet passed is not attached"); // Update the header // Data.Update(); // Create a file stream // using (FileStream fs = File.Create(Data.Header.Path)) { // Create a binary stream to write over the data // using (BinaryWriter br = new BinaryWriter(fs)) { // Write the record set // BinarySerializer.WriteRecordSetSafe(br, Data); } } // Increment writes // _DISK_WRITES++; }
private static void WriteRecordSetSafe2(Stream Writer, RecordSet Data) { /* * Write: * Header * Schema * SortKey * Record Collection */ // Update the data // Data.Update(); // Write header // BinarySerializer.WriteRecordSafe2(Writer, Data.Header); // Write columns // BinarySerializer.WriteRecordsSafe2(Writer, Data.Columns._Cache); // Write sort key // BinarySerializer.WriteRecordSafe2(Writer, Data.SortBy.ToRecord()); // Write cache // BinarySerializer.WriteRecordsSafe2(Writer, Data._Cache); }
private static int WriteRecordSetSafe4(byte[] Mem, int Location, RecordSet Data) { /* * Write: * Header * Schema * SortKey * Record Collection */ // Update the data // Data.Update(); // Write header // Location = BinarySerializer.WriteRecordSafe4(Mem, Location, Data.Header); //Console.WriteLine("Header Terminator: {0}", Location); // Write columns // Location = BinarySerializer.WriteRecordsSafe4(Mem, Location, Data.Columns._Cache); //Console.WriteLine("Schema Terminator: {0}", Location); // Write sort key // Location = BinarySerializer.WriteRecordSafe4(Mem, Location, Data.SortBy.ToRecord()); //Console.WriteLine("Keys Terminator: {0}", Location); // Write cache // Location = BinarySerializer.WriteRecordsSafe4(Mem, Location, Data._Cache); //Console.WriteLine("Data Terminator: {0}", Location); return Location; }