/// <summary> /// Open our files /// </summary> public void Open() { _fileManager.Scan(); _writefile = _fileManager.OpenCurrentWriteFile(); _readFile = _fileManager.OpenCurrentReadFile(); _count = _fileManager.InitialQueueLength; }
/// <summary> /// Write a record to the file /// </summary> /// <param name="buffer">Buffer to read record from</param> /// <param name="offset">Start offset of the record</param> /// <param name="count">Number of bytes to write (starting at offset)</param> /// <remarks> /// <para> /// Make sure that you call <see cref="FlushWriter" /> once you've enqueued all messages in the current batch. /// There is otherwise no guarantee that the content have been written to disk. /// </para> /// </remarks> public void Enqueue(byte[] buffer, int offset, int count) { if (buffer == null) { throw new ArgumentNullException("buffer"); } if (_writefile.FileSize > MaxFileSizeInBytes) { _writefile.Close(); _writefile = _fileManager.CreateNewWriteFile(); } _writefile.Enqueue(buffer, offset, count); }
/// <summary> /// Write a record to the file /// </summary> /// <param name="buffer">Buffer to read record from</param> /// <param name="offset">Start offset of the record</param> /// <param name="count">Number of bytes to write (starting at offset)</param> /// <remarks> /// <para> /// Make sure that you call <see cref="FlushWriter" /> once you've enqueued all messages in the current batch. /// There is otherwise no guarantee that the content have been written to disk. /// </para> /// </remarks> public void Enqueue(byte[] buffer, int offset, int count) { if (buffer == null) throw new ArgumentNullException("buffer"); if (_writefile.FileSize > MaxFileSizeInBytes) { _writefile.Close(); _writefile = _fileManager.CreateNewWriteFile(); } _writefile.Enqueue(buffer, offset, count); Interlocked.Increment(ref _count); }
/// <summary> /// Open our files /// </summary> public void Open() { _fileManager.Scan(); _writefile = _fileManager.OpenCurrentWriteFile(); _readFile = _fileManager.OpenCurrentReadFile(); }