internal BufferedStreamWriter(Stream stream, BufferedStreamWriterConfig config, IWriter writer) { this.stream = stream; this.writer = writer; shadowBufferSize = config.ShadowBufferSize; currShadowBufferIx = 0; shadowBuffer = writer.RequestBuffer(); }
public DelayedWriter(Stream stream, BufferedStreamWriterConfig config) { this.stream = stream; this.config = config; flushBlockerEvent = new AsyncManualResetEvent(false); writeGatekeeper = new SemaphoreSlim(config.TotalDelayedWriterBlocks); tokenSource = new CancellationTokenSource(); pendingOps = new BlockingCollection <PendingOp>(); availableBuffers = new ConcurrentQueue <ShadowBufferData>(); workerTask = Task.Run(WorkerTaskEntrypoint); }
private static IWriter MakeWriter(Stream stream, BufferedStreamWriterConfig config) { if (config.UseDelayedWrite) { return(new DelayedWriter(stream, config)); } else { return(new SynchronousWriter(stream, config)); } }
public SynchronousWriter(Stream stream, BufferedStreamWriterConfig config) { this.stream = stream; shadowBuffer = new ShadowBufferData(config.ShadowBufferSize); }
public BufferedStreamWriter(Stream stream, BufferedStreamWriterConfig config) : this(stream, config, MakeWriter(stream, config)) { }