/// <summary> /// Initializes new instance of <see cref="StorageFileAppender"/> class. /// </summary> /// <param name="configuration">The configuration parameters for binary storage components</param> /// <param name="streamFactory"><see cref="IStreamFactory"/> object used to create file streams</param> /// <param name="binaryStorageIndex">reference to binary storage index structure</param> /// <exception cref="ArgumentNullException">factory is null</exception> /// <exception cref="IOException">storage file could not be opened</exception> public StorageFileAppender(StorageConfiguration configuration, IStreamFactory streamFactory, IBinaryStorageIndex binaryStorageIndex) { this.configuration = configuration.ThrowIfNull(nameof(configuration)); this.binaryStorageIndex = binaryStorageIndex.ThrowIfNull(nameof(binaryStorageIndex)); this.streamFactory = streamFactory.ThrowIfNull(nameof(streamFactory)); buffer = streamFactory.CreateStreamedIOBuffer(); fileStream = streamFactory.CreateStorageAppendingStream(); ShrinkStorageFile(); pendingCounter = 0; processedCounter = 0; waitingList = new ConcurrentQueue <Tuple <long, ManualResetEvent> >(); cancellationOnDispose = new CancellationTokenSource(); processingThread = new Thread(DoBufferProcessing); processingThread.Start(); writeLock = new object(); }
/// <summary> /// Initializes new instance of <see cref="StorageFileAppender"/> class. /// </summary> /// <param name="streamFactory"><see cref="IStreamFactory"/> object used to create file streams</param> /// <exception cref="ArgumentNullException">factory is null</exception> public StorageFileReader(IStreamFactory streamFactory) { this.streamFactory = streamFactory.ThrowIfNull(nameof(streamFactory)); }
/// <summary> /// Initializes new instance of <see cref="StorageFileReader"/> class. /// </summary> /// <param name="streamFactory"><see cref="IStreamFactory"/> object used to create file streams</param> /// <exception cref="ArgumentNullException">factory is null</exception> public IndexFileBlockProvider(IStreamFactory streamFactory) { streamFactory.ThrowIfNull(nameof(streamFactory)); fileStream = streamFactory.CreateIndexStream(); fileStreamLock = new object(); }