=str - Various Flow and FlowMaterializer improvements

- Switches from using size-of-1/2 Vectors to using Lists
  - Fixes an issue where processorForNode wouldn't use the dispatcher form the settings
  - Adds a dedicated Collect fusion op
  - Adds various simplifications to ActorBasedFlowMaterializer
  - Adds FIXMEs where appropriate
  - Switches `grouped` to use a VectorBuilder
  - Adds support for `scan`
  - ActorBasedFlowMaterializer now uses Iterator instead of head+tail decomp on Seqs
  - Identity and Completed Transformers are now cached
  - Adds dedicated AstNodes for all combinators
  - Adds a hook-in point for fusion in `ActorBasedFlowMaterializer`
  - Adds support for `Operate` an AstNode with a function that create a fusing.Op
  - Adds experimental and slow optimizer as a PoC
  - Adds verification that Ast.Fused does not exist in optimizer input
This commit is contained in:
Viktor Klang 2014-11-09 21:09:50 +01:00
parent efe9331b69
commit db4e5c4a29
51 changed files with 678 additions and 732 deletions

View file

@ -65,8 +65,8 @@ object Source {
* in accordance with the demand coming from the downstream transformation
* steps.
*/
def from[O](iterator: java.util.Iterator[O]): javadsl.Source[O] =
new Source(scaladsl.Source(iterator.asScala))
def from[O](f: japi.Creator[java.util.Iterator[O]]): javadsl.Source[O] =
new Source(scaladsl.Source(() f.create().asScala))
/**
* Helper to create [[Source]] from `Iterable`.
@ -87,14 +87,6 @@ object Source {
def from[O](iterable: java.lang.Iterable[O]): javadsl.Source[O] =
new Source(scaladsl.Source(akka.stream.javadsl.japi.Util.immutableIterable(iterable)))
/**
* Define the sequence of elements to be produced by the given closure.
* The stream ends normally when evaluation of the closure returns a `None`.
* The stream ends exceptionally when an exception is thrown from the closure.
*/
def from[O](f: japi.Creator[akka.japi.Option[O]]): javadsl.Source[O] =
new Source(scaladsl.Source(() f.create().asScala))
/**
* Start a new `Source` from the given `Future`. The stream will consist of
* one element when the `Future` is completed with a successful value, which
@ -293,6 +285,15 @@ class Source[+Out](delegate: scaladsl.Source[Out]) {
def grouped(n: Int): javadsl.Source[java.util.List[Out @uncheckedVariance]] =
new Source(delegate.grouped(n).map(_.asJava))
/**
* Similar to `fold` but is not a terminal operation,
* emits its current value which starts at `zero` and then
* applies the current and next value to the given function `f`,
* yielding the next current value.
*/
def scan[T](zero: T)(f: japi.Function2[T, Out, T]): javadsl.Source[T] =
new Source(delegate.scan(zero)(f.apply))
/**
* Chunk up this stream into groups of elements received within a time window,
* or limited by the given number of elements, whatever happens first.