Align lazy and future operators #26446

This commit is contained in:
Johan Andrén 2019-10-16 17:02:12 +02:00 committed by GitHub
parent 4a72985e48
commit 74adecb4e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
59 changed files with 2091 additions and 384 deletions

View file

@ -0,0 +1,32 @@
# completionStage
Send the single value of the `CompletionStage` when it completes and there is demand.
@ref[Source operators](../index.md#source-operators)
@@@div { .group-scala }
## Signature
@@signature [Source.scala](/akka-stream/src/main/scala/akka/stream/scaladsl/Source.scala) { #completionStage }
@@@
## Description
Send the single value of the `CompletionStage` when it completes and there is demand.
If the `CompletionStage` completes with `null` stage is completed without emitting a value.
If the `CompletionStage` fails the stream is failed with that exception.
For the corresponding operator for the Scala standard library `Future` see @ref:[future](future.md).
## Reactive Streams semantics
@@@div { .callout }
**emits** the future completes
**completes** after the future has completed
@@@

View file

@ -0,0 +1,23 @@
# completionStageSource
Streams the elements of an asynchronous source once its given *completion* operator completes.
@ref[Source operators](../index.md#source-operators)
## Signature
## Description
Streams the elements of an asynchronous source once its given *completion* operator completes.
If the *completion* fails the stream is failed with that exception.
## Reactive Streams semantics
@@@div { .callout }
**emits** the next value from the asynchronous source, once its *completion operator* has completed
**completes** after the asynchronous source completes
@@@

View file

@ -1,6 +1,6 @@
# fromCompletionStage
Send the single value of the `CompletionStage` when it completes and there is demand.
`fromCompletionStage` has been deprecated in 2.6.0, use `Source.completionStage`
@ref[Source operators](../index.md#source-operators)
@ -14,6 +14,8 @@ Send the single value of the `CompletionStage` when it completes and there is de
## Description
`fromCompletionStage` has been deprecated in 2.6.0, use @ref:[completionStage](completionStage.md) instead.
Send the single value of the `CompletionStage` when it completes and there is demand.
If the `CompletionStage` completes with `null` stage is completed without emitting a value.
If the `CompletionStage` fails the stream is failed with that exception.

View file

@ -1,6 +1,6 @@
# fromFuture
Send the single value of the `Future` when it completes and there is demand.
`fromFuture` has been deprecated in 2.6.0, use `Source.future` instead.
@ref[Source operators](../index.md#source-operators)
@ -14,6 +14,8 @@ Send the single value of the `Future` when it completes and there is demand.
## Description
`fromFuture` has been deprecated in 2.6.0, use @ref:[future](future.md) instead.
Send the single value of the `Future` when it completes and there is demand.
If the future fails the stream is failed with that exception.
@ -28,6 +30,4 @@ If the future fails the stream is failed with that exception.
@@@
## Example
Scala
: @@snip [SourceFromFuture.scala](/akka-docs/src/test/scala/docs/stream/operators/SourceOperators.scala) { #sourceFromFuture }

View file

@ -1,6 +1,6 @@
# fromFutureSource
Streams the elements of the given future source once it successfully completes.
`fromFutureSource` has been deprecated in 2.6.0, use `Source.futureSource` instead.
@ref[Source operators](../index.md#source-operators)
@ -14,6 +14,8 @@ Streams the elements of the given future source once it successfully completes.
## Description
`fromFutureSource` has been deprecated in 2.6.0, use @ref:[futureSource](futureSource.md) instead.
Streams the elements of the given future source once it successfully completes.
If the future fails the stream is failed.

View file

@ -1,6 +1,6 @@
# fromSourceCompletionStage
Streams the elements of an asynchronous source once its given *completion* operator completes.
`fromSourceCompletionStage` has been deprecated in 2.6.0, use `Source.completionStageSource` instead.
@ref[Source operators](../index.md#source-operators)
@ -8,6 +8,8 @@ Streams the elements of an asynchronous source once its given *completion* opera
## Description
`fromSourceCompletionStage` has been deprecated in 2.6.0, use @ref:[completionStageSource](completionStageSource.md) instead.
Streams the elements of an asynchronous source once its given *completion* operator completes.
If the *completion* fails the stream is failed with that exception.

View file

@ -0,0 +1,35 @@
# fromFuture
Send the single value of the `Future` when it completes and there is demand.
@ref[Source operators](../index.md#source-operators)
@@@div { .group-scala }
## Signature
@@signature [Source.scala](/akka-stream/src/main/scala/akka/stream/scaladsl/Source.scala) { #future }
@@@
## Description
Send the single value of the `Future` when it completes and there is demand.
If the future fails the stream is failed with that exception.
For the corresponding operator for the Java standard library `CompletionStage` see @ref:[completionStage](completionStage.md).
## Reactive Streams semantics
@@@div { .callout }
**emits** the future completes
**completes** after the future has completed
@@@
## Example
Scala
: @@snip [SourceFromFuture.scala](/akka-docs/src/test/scala/docs/stream/operators/SourceOperators.scala) { #sourceFromFuture }

View file

@ -0,0 +1,29 @@
# futureSource
Streams the elements of the given future source once it successfully completes.
@ref[Source operators](../index.md#source-operators)
@@@div { .group-scala }
## Signature
@@signature [Source.scala](/akka-stream/src/main/scala/akka/stream/scaladsl/Source.scala) { #futureSource }
@@@
## Description
Streams the elements of the given future source once it successfully completes.
If the future fails the stream is failed.
## Reactive Streams semantics
@@@div { .callout }
**emits** the next value from the *future* source, once it has completed
**completes** after the *future* source completes
@@@

View file

@ -1,6 +1,6 @@
# lazily
Defers creation and materialization of a `Source` until there is demand.
`lazily` has been deprecated in 2.6.0, use `Source.lazySource` instead.
@ref[Source operators](../index.md#source-operators)
@ -14,6 +14,8 @@ Defers creation and materialization of a `Source` until there is demand.
## Description
`lazily` has been deprecated in 2.6.0, use @ref:[lazySource](lazySource.md) instead.
Defers creation and materialization of a `Source` until there is demand.
## Reactive Streams semantics

View file

@ -1,6 +1,6 @@
# lazilyAsync
Defers creation and materialization of a `CompletionStage` until there is demand.
`lazily` has been deprecated in 2.6.0, use `Source.lazyFutureSource` instead.
@ref[Source operators](../index.md#source-operators)
@ -8,6 +8,8 @@ Defers creation and materialization of a `CompletionStage` until there is demand
## Description
`lazily` has been deprecated in 2.6.0, use @ref:[lazyFutureSource](lazyFutureSource.md) instead.
Defers creation and materialization of a `CompletionStage` until there is demand.
## Reactive Streams semantics

View file

@ -0,0 +1,25 @@
# lazyCompletionStage
Defers creation of a future of a single element source until there is demand.
@ref[Source operators](../index.md#source-operators)
## Description
Invokes the user supplied factory when the first downstream demand arrives. When the returned future completes
successfully the value is emitted downstream as a single stream element. If the future or the factory fails the
stream is failed.
Note that asynchronous boundaries (and other operators) in the stream may do pre-fetching which counter acts
the laziness and will trigger the factory immediately.
## Reactive Streams semantics
@@@div { .callout }
**emits** when there is downstream demand and the element factory returned future has completed
**completes** after emitting the single element
@@@

View file

@ -0,0 +1,27 @@
# lazyCompletionStageSource
Defers creation of a future source until there is demand.
@ref[Source operators](../index.md#source-operators)
## Description
Invokes the user supplied factory when the first downstream demand arrives. When the returned `CompletionStage` completes
successfully the source switches over to the new source and emits downstream just like if it had been created up front. If the future or the factory fails the
stream is failed.
Note that asynchronous boundaries (and other operators) in the stream may do pre-fetching which counter acts
the laziness and will trigger the factory immediately.
See also @ref:[lazySource](lazySource.md).
## Reactive Streams semantics
@@@div { .callout }
**emits** depends on the wrapped `Source`
**completes** depends on the wrapped `Source`
@@@

View file

@ -0,0 +1,33 @@
# lazyFuture
Defers creation of a future of a single element source until there is demand.
@ref[Source operators](../index.md#source-operators)
@@@div { .group-scala }
## Signature
@@signature [Source.scala](/akka-stream/src/main/scala/akka/stream/scaladsl/Source.scala) { #lazyFuture }
@@@
## Description
Invokes the user supplied factory when the first downstream demand arrives. When the returned future completes
successfully the value is emitted downstream as a single stream element. If the future or the factory fails the
stream is failed.
Note that asynchronous boundaries (and other operators) in the stream may do pre-fetching which counter acts
the laziness and will trigger the factory immediately.
## Reactive Streams semantics
@@@div { .callout }
**emits** when there is downstream demand and the element factory returned future has completed
**completes** after emitting the single element
@@@

View file

@ -0,0 +1,34 @@
# lazyFutureSource
Defers creation and materialization of a `Source` until there is demand.
@ref[Source operators](../index.md#source-operators)
@@@div { .group-scala }
## Signature
@@signature [Source.scala](/akka-stream/src/main/scala/akka/stream/scaladsl/Source.scala) { #lazyFutureSource }
@@@
## Description
Invokes the user supplied factory when the first downstream demand arrives. When the returned future completes
successfully the source switches over to the new source and emits downstream just like if it had been created up front.
Note that asynchronous boundaries (and other operators) in the stream may do pre-fetching which counter acts
the laziness and will trigger the factory immediately.
See also @ref:[lazySource](lazySource.md).
## Reactive Streams semantics
@@@div { .callout }
**emits** depends on the wrapped `Source`
**completes** depends on the wrapped `Source`
@@@

View file

@ -0,0 +1,32 @@
# lazySingle
Defers creation of a single element source until there is demand.
@ref[Source operators](../index.md#source-operators)
@@@div { .group-scala }
## Signature
@@signature [Source.scala](/akka-stream/src/main/scala/akka/stream/scaladsl/Source.scala) { #lazySingle }
@@@
## Description
Invokes the user supplied factory when the first downstream demand arrives, then emits the returned single value
downstream and completes the stream.
Note that asynchronous boundaries (and other operators) in the stream may do pre-fetching which counter acts
the laziness and will trigger the factory immediately.
## Reactive Streams semantics
@@@div { .callout }
**emits** when there is downstream demand and the element factory has completed
**completes** after emitting the single element
@@@

View file

@ -0,0 +1,35 @@
# lazySource
Defers creation and materialization of a `Source` until there is demand.
@ref[Source operators](../index.md#source-operators)
@@@div { .group-scala }
## Signature
@@signature [Source.scala](/akka-stream/src/main/scala/akka/stream/scaladsl/Source.scala) { #lazySource }
@@@
## Description
Defers creation and materialization of a `Source` until there is demand, then emits the elements from the source
downstream just like if it had been created up front.
See also @ref:[lazyFutureSource](lazyFutureSource.md).
Note that asynchronous boundaries (and other operators) in the stream may do pre-fetching which counter acts
the laziness and will trigger the factory immediately.
## Reactive Streams semantics
@@@div { .callout }
**emits** depends on the wrapped `Source`
**completes** depends on the wrapped `Source`
@@@