Example #1
0
 internal PersistentChannelWriter(IChannelWriter <T> writer, bool singleWriter, long initialSize)
 {
     writeLock = singleWriter ? default : AsyncLock.Exclusive();
                 this.writer = writer;
                 fileOptions = new FileCreationOptions(FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.Read, FileOptions.Asynchronous | FileOptions.WriteThrough, initialSize);
                 cursor      = new ChannelCursor(writer.Location, StateFileName);
 }
Example #2
0
 internal PersistentChannelReader(IChannelReader <T> reader, bool singleReader)
 {
     this.reader = reader;
     if (singleReader)
     {
         readLock = default;
         buffer   = new SingleReaderBuffer();
     }
     else
     {
         readLock = AsyncLock.Exclusive();
         buffer   = new MultipleReadersBuffer();
     }
     fileOptions = new FileCreationOptions(FileMode.Open, FileAccess.Read, FileShare.ReadWrite, FileOptions.Asynchronous | FileOptions.SequentialScan);
     cursor      = new ChannelCursor(reader.Location, StateFileName);
 }