Ejemplo n.º 1
0
 /// <summary>
 /// Creates a Sink which writes incoming <see cref="ByteString"/>s to an <see cref="Stream"/> created by the given function.
 /// 
 /// Materializes a <see cref="Task{TResult}"/> of <see cref="IOResult"/> that will be completed with the size of the file (in bytes) at the streams completion,
 /// and a possible exception if IO operation was not completed successfully.
 /// 
 /// You can configure the default dispatcher for this Source by changing the "akka.stream.blocking-io-dispatcher" or
 /// set it for a given Source by using <see cref="ActorAttributes.CreateDispatcher"/>. 
 /// If <paramref name="autoFlush"/> is true the OutputStream will be flushed whenever a byte array is written, defaults to false.
 /// 
 /// The <see cref="Stream"/> will be closed when the stream flowing into this <see cref="Sink{TIn,TMat}"/> is completed. The <see cref="Sink{TIn,TMat}"/>
 /// will cancel the stream when the <see cref="Stream"/> is no longer writable.
 /// </summary>
 /// <param name="createOutputStream">A function which creates the <see cref="Stream"/> to write to</param>
 /// <param name="autoFlush">If set to true the <see cref="Stream"/> will be flushed whenever a byte array is written, default is false</param>
 public static Sink<ByteString, Task<IOResult>> FromOutputStream(Func<Stream> createOutputStream, bool autoFlush = false)
 {
     var shape = new SinkShape<ByteString>(new Inlet<ByteString>("OutputStreamSink"));
     var streamSink = new OutputStreamSink(createOutputStream, DefaultAttributes.OutputStreamSink, shape,
         autoFlush);
     return new Sink<ByteString, Task<IOResult>>(streamSink);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="ref">TBD</param>
 /// <param name="onCompleteMessage">TBD</param>
 /// <param name="attributes">TBD</param>
 /// <param name="shape">TBD</param>
 public ActorRefSink(IActorRef @ref, object onCompleteMessage, Attributes attributes, SinkShape <TIn> shape)
     : base(shape)
 {
     _ref = @ref;
     _onCompleteMessage = onCompleteMessage;
     _attributes        = attributes;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="props">TBD</param>
 /// <param name="attributes">TBD</param>
 /// <param name="shape">TBD</param>
 public ActorSubscriberSink(Props props, Attributes attributes, SinkShape <TIn> shape)
     : base(shape)
 {
     _props      = props;
     _attributes = attributes;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="attributes">TBD</param>
 /// <param name="shape">TBD</param>
 public CancelSink(Attributes attributes, SinkShape <T> shape)
     : base(shape)
 {
     Attributes = attributes;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="subscriber">TBD</param>
 /// <param name="attributes">TBD</param>
 /// <param name="shape">TBD</param>
 public SubscriberSink(ISubscriber <TIn> subscriber, Attributes attributes, SinkShape <TIn> shape) : base(shape)
 {
     Attributes  = attributes;
     _subscriber = subscriber;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="attributes">TBD</param>
 /// <param name="shape">TBD</param>
 public FanoutPublisherSink(Attributes attributes, SinkShape <TIn> shape) : base(shape)
 {
     Attributes = attributes;
 }
Ejemplo n.º 7
0
 protected override SinkModule <ByteString, Task <IOResult> > NewInstance(SinkShape <ByteString> shape)
 => new OutputStreamSink(_createOutput, Attributes, shape, _autoFlush);
Ejemplo n.º 8
0
 protected override SinkModule <ByteString, Task <IOResult> > NewInstance(SinkShape <ByteString> shape)
 => new FileSink(_f, _fileMode, Attributes, shape);
Ejemplo n.º 9
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="shape">TBD</param>
 /// <returns>TBD</returns>
 protected override SinkModule <TIn, IPublisher <TIn> > NewInstance(SinkShape <TIn> shape)
 => new FanoutPublisherSink <TIn, TStreamBuffer>(Attributes, shape, _onTerminated);
Ejemplo n.º 10
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="attributes">TBD</param>
 /// <param name="shape">TBD</param>
 /// <param name="onTerminated">TBD</param>
 public FanoutPublisherSink(Attributes attributes, SinkShape <TIn> shape, Action onTerminated = null) : base(shape)
 {
     Attributes    = attributes;
     _onTerminated = onTerminated;
 }
Ejemplo n.º 11
0
 public CompletionLatch()
 {
     Shape = new SinkShape <MutableElement>(In);
 }
Ejemplo n.º 12
0
        public static GraphDsl.Builder <TMat> To <TIn, TOut, TMat>(this GraphDsl.ForwardOps <TOut, TMat> ops, SinkShape <TIn> sink)
            where TIn : TOut
        {
            var b = ops.Builder;

            b.AddEdge(ops.Out, sink.Inlet);
            return(b);
        }
Ejemplo n.º 13
0
 public ReverseOps <TIn, T> To <TIn>(SinkShape <TIn> sink)
 {
     return(new ReverseOps <TIn, T>(this, sink.Inlet));
 }
Ejemplo n.º 14
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="readTimeout">TBD</param>
 public InputStreamSinkStage(TimeSpan readTimeout)
 {
     _readTimeout = readTimeout;
     Shape        = new SinkShape <ByteString>(_in);
 }
Ejemplo n.º 15
0
 protected override SinkModule <T, TestSubscriber.Probe <T> > NewInstance(SinkShape <T> shape)
 {
     return(new ProbeSink <T>(_testKit, _attributes, shape));
 }
Ejemplo n.º 16
0
 /// <summary>
 /// TBD
 /// </summary>
 public QueueSink()
 {
     Shape = new SinkShape <T>(In);
 }
Ejemplo n.º 17
0
 private TestSinkStage(GraphStageWithMaterializedValue <SinkShape <T>, TMat> stageUnderTest, TestProbe probe)
 {
     _stageUnderTest = stageUnderTest;
     _probe          = probe;
     Shape           = new SinkShape <T>(_in);
 }
Ejemplo n.º 18
0
 public OutputStreamSink(Func <Stream> createOutput, Attributes attributes, SinkShape <ByteString> shape, bool autoFlush) : base(shape)
 {
     _createOutput = createOutput;
     Attributes    = attributes;
     _autoFlush    = autoFlush;
 }
Ejemplo n.º 19
0
 public IgnoreSink()
 {
     Shape = new SinkShape <T>(Inlet);
 }
Ejemplo n.º 20
0
 public SumTestStage(IActorRef probe)
 {
     _probe = probe;
     Shape  = new SinkShape <int>(_inlet);
 }
Ejemplo n.º 21
0
 public ObservableSinkStage()
 {
     Shape = new SinkShape <T>(Inlet);
 }
Ejemplo n.º 22
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="shape">TBD</param>
 /// <returns>TBD</returns>
 protected override SinkModule <TIn, IPublisher <TIn> > NewInstance(SinkShape <TIn> shape)
 => new FanoutPublisherSink <TIn>(Attributes, shape);
Ejemplo n.º 23
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="shape">TBD</param>
 /// <returns>TBD</returns>
 protected override SinkModule <TIn, NotUsed> NewInstance(SinkShape <TIn> shape)
 => new ActorRefSink <TIn>(_ref, _onCompleteMessage, _attributes, shape);
Ejemplo n.º 24
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="shape">TBD</param>
 /// <returns>TBD</returns>
 protected override SinkModule <TIn, NotUsed> NewInstance(SinkShape <TIn> shape)
 => new SubscriberSink <TIn>(_subscriber, Attributes, shape);
Ejemplo n.º 25
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="shape">TBD</param>
 protected SinkModule(SinkShape <TIn> shape)
 {
     _shape = shape;
 }
Ejemplo n.º 26
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="shape">TBD</param>
 /// <returns>TBD</returns>
 protected override SinkModule <T, NotUsed> NewInstance(SinkShape <T> shape)
 => new CancelSink <T>(Attributes, shape);
Ejemplo n.º 27
0
 /// <summary>
 /// TBD
 /// </summary>
 public FirstOrDefaultStage()
 {
     Shape = new SinkShape <T>(In);
 }
Ejemplo n.º 28
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="shape">TBD</param>
 /// <returns>TBD</returns>
 protected override SinkModule <TIn, IActorRef> NewInstance(SinkShape <TIn> shape)
 => new ActorSubscriberSink <TIn>(_props, _attributes, shape);
Ejemplo n.º 29
0
 /// <summary>
 /// TBD
 /// </summary>
 public SeqStage()
 {
     Shape = new SinkShape <T>(In);
 }
Ejemplo n.º 30
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="shape">TBD</param>
 /// <returns>TBD</returns>
 protected abstract SinkModule <TIn, TMat> NewInstance(SinkShape <TIn> shape);
Ejemplo n.º 31
0
 public ProbeSink(TestKitBase testKit, Attributes attributes, SinkShape <T> shape) : base(shape)
 {
     _testKit    = testKit;
     _attributes = attributes;
 }