public BufferedWriter(string fname, WriterOptions opt) { if (opt == null) { throw new ArgumentNullException(nameof(opt)); } opt.Validate(); _opt = opt.Clone(); _writer = new ChunkWriter(fname); _closeChunk = new Timer(_mutex, () => DoCloseChunk(flushToDisk: null), _opt.CloseChunk?.AgeRetry); _flushToOS = new Timer(_mutex, () => DoFlush(flushToDisk: false), _opt.FlushToOS?.AgeRetry); _flushToDisk = new Timer(_mutex, () => DoFlush(flushToDisk: true), _opt.FlushToDisk?.AgeRetry); if (_opt.AllowRemoteFlush) { _listener = new RemoteFlush.Listener(_writer.Id, FlushAsync); } }
// The file must be exclusively writable. If it exists, it gets appended to. // You can use TimeSeriesReader to read the file. You can even do it while // having an active writer. // // Takes ownership of the encoder. TimeSeriesWriter.Dispose() will dispose it. public TimeSeriesWriter(string fname, ITimeSeriesEncoder <T> encoder, WriterOptions opt) { Encoder = encoder ?? throw new ArgumentNullException(nameof(encoder)); _writer = new BufferedWriter(fname, opt); }