예제 #1
0
 public OutputStreamSubscriber(Stream outputStream, TaskCompletionSource<IOResult> completionPromise, int bufferSize, bool autoFlush)
 {
     _outputStream = outputStream;
     _completionPromise = completionPromise;
     _autoFlush = autoFlush;
     RequestStrategy = new WatermarkRequestStrategy(highWatermark: bufferSize);
     _log = Context.GetLogger();
 }
예제 #2
0
 public FileSubscriber(FileInfo f, TaskCompletionSource<IOResult> completionPromise, int bufferSize, FileMode fileMode)
 {
     _f = f;
     _completionPromise = completionPromise;
     _fileMode = fileMode;
     _log = Context.GetLogger();
     _requestStrategy = new WatermarkRequestStrategy(highWatermark: bufferSize);
 }
예제 #3
0
 public void Provided_RequestStragies_should_implement_Watermark_correctly()
 {
     var strat = new WatermarkRequestStrategy(highWatermark: 10);
     strat.RequestDemand(0).Should().Be(10);
     strat.RequestDemand(9).Should().Be(0);
     strat.RequestDemand(6).Should().Be(0);
     strat.RequestDemand(5).Should().Be(0);
     strat.RequestDemand(4).Should().Be(6);
 }
예제 #4
0
        public ActorRefSinkActor(IActorRef @ref, int highWatermark, object onCompleteMessage)
        {
            Ref = @ref;
            HighWatermark = highWatermark;
            OnCompleteMessage = onCompleteMessage;
            RequestStrategy = new WatermarkRequestStrategy(highWatermark);

            Context.Watch(Ref);
        }