/// <exception cref="System.IO.IOException"></exception> public virtual void Write(string path, RandomAccessFile raf, bool writeTrash) { if (_offset == 0) { writeTrash = false; } raf.Seek(_offset); raf.Write(BytesToWrite(_data, writeTrash), 0, _length); Write(FileBasedTransactionLogHandler.LockFileName(path), _lockFileData, writeTrash ); Write(FileBasedTransactionLogHandler.LogFileName(path), _logFileData, writeTrash); }
public virtual void Add(string path, byte[] bytes, long offset, int length) { byte[] lockFileBuffer = null; byte[] logFileBuffer = null; if (File.Exists(FileBasedTransactionLogHandler.LockFileName(path))) { try { lockFileBuffer = ReadAllBytes(FileBasedTransactionLogHandler.LockFileName(path)); logFileBuffer = ReadAllBytes(FileBasedTransactionLogHandler.LogFileName(path)); } catch (IOException e) { Runtime.PrintStackTrace(e); } } var crashSimulatingWrite = new CrashSimulatingWrite(_counter++, bytes, offset, length, lockFileBuffer, logFileBuffer); _currentWrite.Add(crashSimulatingWrite); }