From eca459e461021cdfa76b0b3b2e170b0db1ae9e92 Mon Sep 17 00:00:00 2001 From: Arnout Engelen Date: Fri, 31 May 2019 12:56:25 +0200 Subject: [PATCH] Include fan-out operators in the operator index (#27028) --- .../src/main/categories/fan-out-operators.md | 4 ++- akka-docs/src/main/paradox/.htaccess | 7 +++++ .../{Source-or-Flow/balance.md => Balance.md} | 4 +-- .../broadcast.md => Broadcast.md} | 4 +-- .../partition.md => Partition.md} | 4 +-- .../stream/operators/Source-or-Flow/alsoTo.md | 2 +- .../operators/Source-or-Flow/divertTo.md | 2 +- .../operators/Source-or-Flow/wireTap.md | 2 +- .../{Source-or-Flow/unzip.md => Unzip.md} | 4 +-- .../unzipWith.md => UnzipWith.md} | 2 +- .../main/paradox/stream/operators/index.md | 27 ++++++++++++++++--- project/StreamOperatorsIndexGenerator.scala | 15 ++++++++--- 12 files changed, 58 insertions(+), 19 deletions(-) rename akka-docs/src/main/paradox/stream/operators/{Source-or-Flow/balance.md => Balance.md} (89%) rename akka-docs/src/main/paradox/stream/operators/{Source-or-Flow/broadcast.md => Broadcast.md} (87%) rename akka-docs/src/main/paradox/stream/operators/{Source-or-Flow/partition.md => Partition.md} (90%) rename akka-docs/src/main/paradox/stream/operators/{Source-or-Flow/unzip.md => Unzip.md} (87%) rename akka-docs/src/main/paradox/stream/operators/{Source-or-Flow/unzipWith.md => UnzipWith.md} (97%) diff --git a/akka-docs/src/main/categories/fan-out-operators.md b/akka-docs/src/main/categories/fan-out-operators.md index 3bfc844c78..6f6c93282a 100644 --- a/akka-docs/src/main/categories/fan-out-operators.md +++ b/akka-docs/src/main/categories/fan-out-operators.md @@ -1,2 +1,4 @@ These have one input and multiple outputs. They might route the elements between different outputs, or emit elements on -multiple outputs at the same time. \ No newline at end of file +multiple outputs at the same time. + +There is a number of fan-out operators for which currently no 'fluent' is API available. To use those you will have to use the @ref[Graph DSL](../stream-graphs.md#constructing-graphs). diff --git a/akka-docs/src/main/paradox/.htaccess b/akka-docs/src/main/paradox/.htaccess index cf142d66e5..9c3579c943 100644 --- a/akka-docs/src/main/paradox/.htaccess +++ b/akka-docs/src/main/paradox/.htaccess @@ -15,3 +15,10 @@ RedirectMatch 301 ^(.*)/project/migration-guide-stream-2\.0-2\.4.html.* $1/proje RedirectMatch 301 ^(.*)/stream/stages-overview\.html$ $1/stream/operators/index.html RedirectMatch 301 ^(.*)/agents\.html$ $1/project/migration-guide-2.5.x-2.6.x.html RedirectMatch 301 ^(.*)/typed-actors\.html$ $1/project/migration-guide-2.5.x-2.6.x.html#typedactor + + +RedirectMatch 301 ^(.*)/stream/operators/Source-or-Flow/balance\.html$ $1/stream/operators/Balance.html +RedirectMatch 301 ^(.*)/stream/operators/Source-or-Flow/broadcast\.html$ $1/stream/operators/Broadcast.html +RedirectMatch 301 ^(.*)/stream/operators/Source-or-Flow/partition\.html$ $1/stream/operators/Partition.html +RedirectMatch 301 ^(.*)/stream/operators/Source-or-Flow/unzip\.html$ $1/stream/operators/unzip.html +RedirectMatch 301 ^(.*)/stream/operators/Source-or-Flow/UnzipWith\.html$ $1/stream/operators/UnzipWith.html diff --git a/akka-docs/src/main/paradox/stream/operators/Source-or-Flow/balance.md b/akka-docs/src/main/paradox/stream/operators/Balance.md similarity index 89% rename from akka-docs/src/main/paradox/stream/operators/Source-or-Flow/balance.md rename to akka-docs/src/main/paradox/stream/operators/Balance.md index 0bc0a7aef3..e108cb95b9 100644 --- a/akka-docs/src/main/paradox/stream/operators/Source-or-Flow/balance.md +++ b/akka-docs/src/main/paradox/stream/operators/Balance.md @@ -1,8 +1,8 @@ -# balance +# Balance Fan-out the stream to several streams. -@ref[Fan-out operators](../index.md#fan-out-operators) +@ref[Fan-out operators](index.md#fan-out-operators) ## Description diff --git a/akka-docs/src/main/paradox/stream/operators/Source-or-Flow/broadcast.md b/akka-docs/src/main/paradox/stream/operators/Broadcast.md similarity index 87% rename from akka-docs/src/main/paradox/stream/operators/Source-or-Flow/broadcast.md rename to akka-docs/src/main/paradox/stream/operators/Broadcast.md index d72c55ddc3..4c3b8b025e 100644 --- a/akka-docs/src/main/paradox/stream/operators/Source-or-Flow/broadcast.md +++ b/akka-docs/src/main/paradox/stream/operators/Broadcast.md @@ -1,8 +1,8 @@ -# broadcast +# Broadcast Emit each incoming element each of `n` outputs. -@ref[Fan-out operators](../index.md#fan-out-operators) +@ref[Fan-out operators](index.md#fan-out-operators) ## Description diff --git a/akka-docs/src/main/paradox/stream/operators/Source-or-Flow/partition.md b/akka-docs/src/main/paradox/stream/operators/Partition.md similarity index 90% rename from akka-docs/src/main/paradox/stream/operators/Source-or-Flow/partition.md rename to akka-docs/src/main/paradox/stream/operators/Partition.md index a9c6d01660..4b582834e8 100644 --- a/akka-docs/src/main/paradox/stream/operators/Source-or-Flow/partition.md +++ b/akka-docs/src/main/paradox/stream/operators/Partition.md @@ -1,8 +1,8 @@ -# partition +# Partition Fan-out the stream to several streams. -@ref[Fan-out operators](../index.md#fan-out-operators) +@ref[Fan-out operators](index.md#fan-out-operators) ## Signature diff --git a/akka-docs/src/main/paradox/stream/operators/Source-or-Flow/alsoTo.md b/akka-docs/src/main/paradox/stream/operators/Source-or-Flow/alsoTo.md index 561d21109b..da2a96d7ad 100644 --- a/akka-docs/src/main/paradox/stream/operators/Source-or-Flow/alsoTo.md +++ b/akka-docs/src/main/paradox/stream/operators/Source-or-Flow/alsoTo.md @@ -2,7 +2,7 @@ Attaches the given `Sink` to this `Flow`, meaning that elements that pass through this `Flow` will also be sent to the `Sink`. -@ref[Simple operators](../index.md#simple-operators) +@ref[Fan-out operators](../index.md#fan-out-operators) @@@ div { .group-scala } ## Signature diff --git a/akka-docs/src/main/paradox/stream/operators/Source-or-Flow/divertTo.md b/akka-docs/src/main/paradox/stream/operators/Source-or-Flow/divertTo.md index efde709b35..21745089a8 100644 --- a/akka-docs/src/main/paradox/stream/operators/Source-or-Flow/divertTo.md +++ b/akka-docs/src/main/paradox/stream/operators/Source-or-Flow/divertTo.md @@ -2,7 +2,7 @@ Each upstream element will either be diverted to the given sink, or the downstream consumer according to the predicate function applied to the element. -@ref[Simple operators](../index.md#simple-operators) +@ref[Fan-out operators](../index.md#fan-out-operators) @@@div { .group-scala } diff --git a/akka-docs/src/main/paradox/stream/operators/Source-or-Flow/wireTap.md b/akka-docs/src/main/paradox/stream/operators/Source-or-Flow/wireTap.md index 8f74917132..cc4d67d2d7 100644 --- a/akka-docs/src/main/paradox/stream/operators/Source-or-Flow/wireTap.md +++ b/akka-docs/src/main/paradox/stream/operators/Source-or-Flow/wireTap.md @@ -2,7 +2,7 @@ Attaches the given `Sink` to this `Flow` as a wire tap, meaning that elements that pass through will also be sent to the wire-tap `Sink`, without the latter affecting the mainline flow. -@ref[Simple operators](../index.md#simple-operators) +@ref[Fan-out operators](../index.md#fan-out-operators) @@@div { .group-scala } diff --git a/akka-docs/src/main/paradox/stream/operators/Source-or-Flow/unzip.md b/akka-docs/src/main/paradox/stream/operators/Unzip.md similarity index 87% rename from akka-docs/src/main/paradox/stream/operators/Source-or-Flow/unzip.md rename to akka-docs/src/main/paradox/stream/operators/Unzip.md index 8e1a3d8589..e601583be2 100644 --- a/akka-docs/src/main/paradox/stream/operators/Source-or-Flow/unzip.md +++ b/akka-docs/src/main/paradox/stream/operators/Unzip.md @@ -1,8 +1,8 @@ -# unzip +# Unzip Takes a stream of two element tuples and unzips the two elements ino two different downstreams. -@ref[Fan-out operators](../index.md#fan-out-operators) +@ref[Fan-out operators](index.md#fan-out-operators) ## Signature diff --git a/akka-docs/src/main/paradox/stream/operators/Source-or-Flow/unzipWith.md b/akka-docs/src/main/paradox/stream/operators/UnzipWith.md similarity index 97% rename from akka-docs/src/main/paradox/stream/operators/Source-or-Flow/unzipWith.md rename to akka-docs/src/main/paradox/stream/operators/UnzipWith.md index 9d2f6c5420..add74e346a 100644 --- a/akka-docs/src/main/paradox/stream/operators/Source-or-Flow/unzipWith.md +++ b/akka-docs/src/main/paradox/stream/operators/UnzipWith.md @@ -1,4 +1,4 @@ -# unzipWith +# UnzipWith Splits each element of input into multiple downstreams using a function diff --git a/akka-docs/src/main/paradox/stream/operators/index.md b/akka-docs/src/main/paradox/stream/operators/index.md index 60428cc4b5..4811a35e29 100644 --- a/akka-docs/src/main/paradox/stream/operators/index.md +++ b/akka-docs/src/main/paradox/stream/operators/index.md @@ -126,12 +126,10 @@ depending on being backpressured by downstream or not. | |Operator|Description| |--|--|--| -|Source/Flow|@ref[alsoTo](Source-or-Flow/alsoTo.md)|Attaches the given `Sink` to this `Flow`, meaning that elements that pass through this `Flow` will also be sent to the `Sink`.| |Flow|@ref[asFlowWithContext](Flow/asFlowWithContext.md)|Turns a Flow into a FlowWithContext which can propagate a context per element along a stream.| |Source/Flow|@ref[collect](Source-or-Flow/collect.md)|Apply a partial function to each incoming element, if the partial function is defined for a value the returned value is passed downstream.| |Source/Flow|@ref[collectType](Source-or-Flow/collectType.md)|Transform this stream by testing the type of each of the elements on which the element is an instance of the provided type as they pass through this processing step.| |Source/Flow|@ref[detach](Source-or-Flow/detach.md)|Detach upstream demand from downstream demand without detaching the stream rates.| -|Source/Flow|@ref[divertTo](Source-or-Flow/divertTo.md)|Each upstream element will either be diverted to the given sink, or the downstream consumer according to the predicate function applied to the element.| |Source/Flow|@ref[drop](Source-or-Flow/drop.md)|Drop `n` elements and then pass any subsequent element downstream.| |Source/Flow|@ref[dropWhile](Source-or-Flow/dropWhile.md)|Drop elements as long as a predicate function return true for the element| |Source/Flow|@ref[filter](Source-or-Flow/filter.md)|Filter the incoming elements using a predicate.| @@ -160,7 +158,6 @@ depending on being backpressured by downstream or not. |Source/Flow|@ref[takeWhile](Source-or-Flow/takeWhile.md)|Pass elements downstream as long as a predicate function return true for the element include the element when the predicate first return false and then complete.| |Source/Flow|@ref[throttle](Source-or-Flow/throttle.md)|Limit the throughput to a specific number of elements per time unit, or a specific total cost per time unit, where a function has to be provided to calculate the individual cost of each element.| |Source/Flow|@ref[watch](Source-or-Flow/watch.md)|Watch a specific `ActorRef` and signal a failure downstream once the actor terminates.| -|Source/Flow|@ref[wireTap](Source-or-Flow/wireTap.md)|Attaches the given `Sink` to this `Flow` as a wire tap, meaning that elements that pass through will also be sent to the wire-tap `Sink`, without the latter affecting the mainline flow.| ## Flow operators composed of Sinks and Sources @@ -257,6 +254,25 @@ the inputs in different ways. |Source/Flow|@ref[zipWith](Source-or-Flow/zipWith.md)|Combines elements from multiple sources through a `combine` function and passes the returned value downstream.| |Source/Flow|@ref[zipWithIndex](Source-or-Flow/zipWithIndex.md)|Zips elements of current flow with its indices.| +## Fan-out operators + +These have one input and multiple outputs. They might route the elements between different outputs, or emit elements on +multiple outputs at the same time. + +There is a number of fan-out operators for which currently no 'fluent' is API available. To use those you will have to use the @ref[Graph DSL](../stream-graphs.md#constructing-graphs). + + +| |Operator|Description| +|--|--|--| +| |@ref[Balance](Balance.md)|Fan-out the stream to several streams.| +| |@ref[Broadcast](Broadcast.md)|Emit each incoming element each of `n` outputs.| +| |@ref[Partition](Partition.md)|Fan-out the stream to several streams.| +| |@ref[Unzip](Unzip.md)|Takes a stream of two element tuples and unzips the two elements ino two different downstreams.| +| |@ref[UnzipWith](UnzipWith.md)|Splits each element of input into multiple downstreams using a function| +|Source/Flow|@ref[alsoTo](Source-or-Flow/alsoTo.md)|Attaches the given `Sink` to this `Flow`, meaning that elements that pass through this `Flow` will also be sent to the `Sink`.| +|Source/Flow|@ref[divertTo](Source-or-Flow/divertTo.md)|Each upstream element will either be diverted to the given sink, or the downstream consumer according to the predicate function applied to the element.| +|Source/Flow|@ref[wireTap](Source-or-Flow/wireTap.md)|Attaches the given `Sink` to this `Flow` as a wire tap, meaning that elements that pass through will also be sent to the wire-tap `Sink`, without the latter affecting the mainline flow.| + ## Watching status operators @@ -439,5 +455,10 @@ For more background see the @ref[Error Handling in Streams](../stream-error.md) * [actorRefWithAck](ActorSource/actorRefWithAck.md) * [ask](ActorFlow/ask.md) * [actorRef](ActorSink/actorRef.md) +* [Partition](Partition.md) +* [Broadcast](Broadcast.md) +* [Balance](Balance.md) +* [Unzip](Unzip.md) +* [UnzipWith](UnzipWith.md) @@@ diff --git a/project/StreamOperatorsIndexGenerator.scala b/project/StreamOperatorsIndexGenerator.scala index 6117953594..dc4acf3091 100644 --- a/project/StreamOperatorsIndexGenerator.scala +++ b/project/StreamOperatorsIndexGenerator.scala @@ -32,8 +32,7 @@ object StreamOperatorsIndexGenerator extends AutoPlugin { "Nesting and flattening operators", "Time aware operators", "Fan-in operators", - // TODO these don't show up as def's yet so don't show up in the index.. -// "Fan-out operators", + "Fan-out operators", "Watching status operators", "Actor interop operators", "Error handling" @@ -125,6 +124,8 @@ object StreamOperatorsIndexGenerator extends AutoPlugin { def isPending(element: String, opName: String) = pendingTestCases.get(element).exists(_.contains(opName)) + val noElement = " " + def generateAlphabeticalIndex(dir: SettingKey[File], locate: File => File) = Def.task[Seq[File]] { val file = locate(dir.value) @@ -170,7 +171,13 @@ object StreamOperatorsIndexGenerator extends AutoPlugin { .filter(op => !ignore.contains(op)) .map(_.replaceAll("Mat$", "")) .map(method => (element, method)) - } + } ++ List( + (noElement, "Partition"), + (noElement, "Broadcast"), + (noElement, "Balance"), + (noElement, "Unzip"), + (noElement, "UnzipWith") + ) val sourceAndFlow = defs.collect { case ("Source", method) => method } intersect defs.collect { case ("Flow", method) => method } @@ -178,6 +185,8 @@ object StreamOperatorsIndexGenerator extends AutoPlugin { defs.map { case (element @ ("Source" | "Flow"), method) if sourceAndFlow.contains(method) => ("Source/Flow", method, s"Source-or-Flow/$method.md") + case (`noElement`, method) => + (noElement, method, s"$method.md") case (element, method) => (element, method, s"$element/$method.md") }.distinct