Include fan-out operators in the operator index (#27028)

This commit is contained in:
Arnout Engelen 2019-05-31 12:56:25 +02:00 committed by Johan Andrén
parent e61703bb4a
commit eca459e461
12 changed files with 58 additions and 19 deletions

View file

@ -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.
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).

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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 }

View file

@ -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 }

View file

@ -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

View file

@ -1,4 +1,4 @@
# unzipWith
# UnzipWith
Splits each element of input into multiple downstreams using a function

View file

@ -126,12 +126,10 @@ depending on being backpressured by downstream or not.
| |Operator|Description|
|--|--|--|
|Source/Flow|<a name="alsoto"></a>@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|<a name="asflowwithcontext"></a>@ref[asFlowWithContext](Flow/asFlowWithContext.md)|Turns a Flow into a FlowWithContext which can propagate a context per element along a stream.|
|Source/Flow|<a name="collect"></a>@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|<a name="collecttype"></a>@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|<a name="detach"></a>@ref[detach](Source-or-Flow/detach.md)|Detach upstream demand from downstream demand without detaching the stream rates.|
|Source/Flow|<a name="divertto"></a>@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|<a name="drop"></a>@ref[drop](Source-or-Flow/drop.md)|Drop `n` elements and then pass any subsequent element downstream.|
|Source/Flow|<a name="dropwhile"></a>@ref[dropWhile](Source-or-Flow/dropWhile.md)|Drop elements as long as a predicate function return true for the element|
|Source/Flow|<a name="filter"></a>@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|<a name="takewhile"></a>@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|<a name="throttle"></a>@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|<a name="watch"></a>@ref[watch](Source-or-Flow/watch.md)|Watch a specific `ActorRef` and signal a failure downstream once the actor terminates.|
|Source/Flow|<a name="wiretap"></a>@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|<a name="zipwith"></a>@ref[zipWith](Source-or-Flow/zipWith.md)|Combines elements from multiple sources through a `combine` function and passes the returned value downstream.|
|Source/Flow|<a name="zipwithindex"></a>@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|
|--|--|--|
| |<a name="balance"></a>@ref[Balance](Balance.md)|Fan-out the stream to several streams.|
| |<a name="broadcast"></a>@ref[Broadcast](Broadcast.md)|Emit each incoming element each of `n` outputs.|
| |<a name="partition"></a>@ref[Partition](Partition.md)|Fan-out the stream to several streams.|
| |<a name="unzip"></a>@ref[Unzip](Unzip.md)|Takes a stream of two element tuples and unzips the two elements ino two different downstreams.|
| |<a name="unzipwith"></a>@ref[UnzipWith](UnzipWith.md)|Splits each element of input into multiple downstreams using a function|
|Source/Flow|<a name="alsoto"></a>@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|<a name="divertto"></a>@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|<a name="wiretap"></a>@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)
@@@

View file

@ -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