Extrapolate stage and expand redoc #23804
This commit is contained in:
parent
26f0f86088
commit
00068e2d1d
13 changed files with 670 additions and 82 deletions
|
|
@ -2113,7 +2113,9 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* subscriber.
|
||||
*
|
||||
* Expand does not support [[akka.stream.Supervision#restart]] and [[akka.stream.Supervision#resume]].
|
||||
* Exceptions from the `seed` or `extrapolate` functions will complete the stream with failure.
|
||||
* Exceptions from the `expander` function will complete the stream with failure.
|
||||
*
|
||||
* See also [[#extrapolate]] for a version that always preserves the original element and allows for an initial "startup" element.
|
||||
*
|
||||
* '''Emits when''' downstream stops backpressuring
|
||||
*
|
||||
|
|
@ -2123,11 +2125,67 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
*
|
||||
* '''Cancels when''' downstream cancels
|
||||
*
|
||||
* @param extrapolate Takes the current extrapolation state to produce an output element and the next extrapolation
|
||||
* state.
|
||||
* @param expander Takes the current extrapolation state to produce an output element and the next extrapolation
|
||||
* state.
|
||||
* @see [[#extrapolate]]
|
||||
*/
|
||||
def expand[U](extrapolate: function.Function[Out, java.util.Iterator[U]]): javadsl.Source[U, Mat] =
|
||||
new Source(delegate.expand(in ⇒ extrapolate(in).asScala))
|
||||
def expand[U](expander: function.Function[Out, java.util.Iterator[U]]): javadsl.Source[U, Mat] =
|
||||
new Source(delegate.expand(in ⇒ expander(in).asScala))
|
||||
|
||||
/**
|
||||
* Allows a faster downstream to progress independent of a slower upstream.
|
||||
*
|
||||
* This is achieved by introducing "extrapolated" elements - based on those from upstream - whenever downstream
|
||||
* signals demand.
|
||||
*
|
||||
* Extrapolate does not support [[akka.stream.Supervision#restart]] and [[akka.stream.Supervision#resume]].
|
||||
* Exceptions from the `extrapolate` function will complete the stream with failure.
|
||||
*
|
||||
* See also [[#expand]] for a version that can overwrite the original element.
|
||||
*
|
||||
* '''Emits when''' downstream stops backpressuring, AND EITHER upstream emits OR initial element is present OR
|
||||
* `extrapolate` is non-empty and applicable
|
||||
*
|
||||
* '''Backpressures when''' downstream backpressures or current `extrapolate` runs empty
|
||||
*
|
||||
* '''Completes when''' upstream completes and current `extrapolate` runs empty
|
||||
*
|
||||
* '''Cancels when''' downstream cancels
|
||||
*
|
||||
* @param extrapolator Takes the current upstream element and provides a sequence of "extrapolated" elements based
|
||||
* on the original, to be emitted in case downstream signals demand.
|
||||
* @see [[#expand]]
|
||||
*/
|
||||
def extrapolate(extrapolator: function.Function[Out @uncheckedVariance, java.util.Iterator[Out @uncheckedVariance]]): Source[Out, Mat] =
|
||||
new Source(delegate.extrapolate(in ⇒ extrapolator(in).asScala))
|
||||
|
||||
/**
|
||||
* Allows a faster downstream to progress independent of a slower upstream.
|
||||
*
|
||||
* This is achieved by introducing "extrapolated" elements - based on those from upstream - whenever downstream
|
||||
* signals demand.
|
||||
*
|
||||
* Extrapolate does not support [[akka.stream.Supervision#restart]] and [[akka.stream.Supervision#resume]].
|
||||
* Exceptions from the `extrapolate` function will complete the stream with failure.
|
||||
*
|
||||
* See also [[#expand]] for a version that can overwrite the original element.
|
||||
*
|
||||
* '''Emits when''' downstream stops backpressuring, AND EITHER upstream emits OR initial element is present OR
|
||||
* `extrapolate` is non-empty and applicable
|
||||
*
|
||||
* '''Backpressures when''' downstream backpressures or current `extrapolate` runs empty
|
||||
*
|
||||
* '''Completes when''' upstream completes and current `extrapolate` runs empty
|
||||
*
|
||||
* '''Cancels when''' downstream cancels
|
||||
*
|
||||
* @param extrapolator takes the current upstream element and provides a sequence of "extrapolated" elements based
|
||||
* on the original, to be emitted in case downstream signals demand.
|
||||
* @param initial the initial element to be emitted, in case upstream is able to stall the entire stream.
|
||||
* @see [[#expand]]
|
||||
*/
|
||||
def extrapolate(extrapolator: function.Function[Out @uncheckedVariance, java.util.Iterator[Out @uncheckedVariance]], initial: Out @uncheckedVariance): Source[Out, Mat] =
|
||||
new Source(delegate.extrapolate(in ⇒ extrapolator(in).asScala, Some(initial)))
|
||||
|
||||
/**
|
||||
* Adds a fixed size buffer in the flow that allows to store elements from a faster upstream until it becomes full.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue