public PlaybackStreamBuilder SetCurrentDateTimeSource(ICurrentDateTimeSource value) { if (value == null) throw new ArgumentNullException("value"); _currentDateTimeSource = value; return this; }
public RollingMemory( IWriteStreamFactory writeStreamFactory, IWriteStreamToReadStreamConverter writeStreamToReadStreamConverter, IStreamDataSourceDisposerFactory writeStreamDataSourceDisposerFactory, IStreamDataSourceDisposerFactory readStreamDataSourceDisposerFactory, IRollingMemoryStateMonitor rollingMemoryStateMonitor, long? maximumAllowedWriteStreamBytes, TimeSpan? maximumAllowedUnavailableAge, long? maximumAllowedUnavailableBytes, ICurrentDateTimeSource currentDateTimeSource) { var readStreamQueue = new ReadStreamQueue(); var dataSourceDisposerRegister = new DataSourceDisposerRegister(); var completedWriteStreamBuffer = new CompletedWriteStreamBuffer( readStreamQueue, writeStreamToReadStreamConverter, readStreamDataSourceDisposerFactory, dataSourceDisposerRegister, maximumAllowedWriteStreamBytes); var rollingMemoryWriteStream = new RollingMemoryWriteStream( writeStreamFactory, completedWriteStreamBuffer, completedWriteStreamBuffer, currentDateTimeSource, writeStreamDataSourceDisposerFactory, dataSourceDisposerRegister, rollingMemoryStateMonitor); var readStreamQueueRefresher = new ReadStreamQueueRefresher( rollingMemoryWriteStream, completedWriteStreamBuffer, maximumAllowedUnavailableAge, maximumAllowedUnavailableBytes); var completedReadStreamHandler = new CompletedReadStreamHandler( dataSourceDisposerRegister); var rollingMemoryReadStream = new RollingMemoryReadStream( readStreamQueue, readStreamQueueRefresher, completedReadStreamHandler, rollingMemoryStateMonitor); _readStream = rollingMemoryReadStream; _writeStream = rollingMemoryWriteStream; _completedWriteStreamBuffer = completedWriteStreamBuffer; }
public RecordingStream(Stream targetStream, ICurrentDateTimeSource currentDateTimeSource, DateTime constructionTimestamp) { if (targetStream == null) throw new ArgumentException("targetStream"); if (currentDateTimeSource == null) throw new ArgumentNullException("currentDateTimeSource"); _targetStream = targetStream; _currentDateTimeSource = currentDateTimeSource; _constructionTimestamp = constructionTimestamp; }
public PlaybackStream(Stream sourceStream, ICurrentDateTimeSource currentDateTimeSource, DateTime constructionTimestamp) { if (sourceStream == null) throw new ArgumentNullException("sourceStream"); if (currentDateTimeSource == null) throw new ArgumentNullException("currentDateTimeSource"); _sourceStream = sourceStream; _currentDateTimeSource = currentDateTimeSource; _constructionTimestamp = constructionTimestamp; CurrentPlaybackState = new ReadingTimeOffsetPlaybackState(); }
public RollingMemoryWriteStream(IWriteStreamFactory targetFactory, ICompletedWriteStreamHandler completedWriteStreamHandler, IWriteStreamLengthValidator activeWriteStreamLengthValidator, ICurrentDateTimeSource currentDateTimeSource, IStreamDataSourceDisposerFactory writeStreamDataSourceDisposerFactory, IDataSourceDisposerRegister dataSourceDisposerRegister, IRollingMemoryStateMonitor rollingMemoryStateMonitor) { _targetFactory = targetFactory; _completedWriteStreamHandler = completedWriteStreamHandler; _activeWriteStreamLengthValidator = activeWriteStreamLengthValidator; _currentDateTimeSource = currentDateTimeSource; _writeStreamDataSourceDisposerFactory = writeStreamDataSourceDisposerFactory; _dataSourceDisposerRegister = dataSourceDisposerRegister; _rollingMemoryStateMonitor = rollingMemoryStateMonitor; }
/// <summary> /// Allows the default CurrentDateTimeSource to be overridden. This simply provides the current /// DateTime from the system; the ability to override it is provided to facilitate unit testing. /// </summary> /// <param name="value"></param> /// <returns></returns> public RollingMemoryBuilder SetCurrentDateTimeSource(ICurrentDateTimeSource value) { if (value == null) throw new ArgumentNullException("value"); _currentDateTimeSource = new Lazy<ICurrentDateTimeSource>(() => value, true); return this; }