internal void CopyCommittedData(Stream tempData, List<Command> cmds)
{
foreach (var kvp in keyToFilePos) // copy committed data
{
long pos = tempData.Position;
byte[] data = ReadData(kvp.Value.Position, kvp.Value.Size);
byte[] lenInBytes = BitConverter.GetBytes(data.Length);
tempData.Write(lenInBytes, 0, lenInBytes.Length);
tempData.Write(data, 0, data.Length);
cmds.Add(new Command
{
Key = kvp.Key,
Position = pos,
DictionaryId = DictionaryId,
Size = kvp.Value.Size,
Type = CommandType.Put
});
kvp.Value.Position = pos;
}
}