com.fsist.stream.run

FutureStreamBuilder

Related Docs: object FutureStreamBuilder | package run

class FutureStreamBuilder extends LazyLogging

Builds the mutable state describing the stream graph being built, and allows building it into a runnable RunningStream.

All operations are concurrent-safe, implemented using compare-and-swap on a single AtomicReference to an immutable State. Since building a graph model usually has no performance issues, this errs in favor of correctness and catching problems early, instead of relying on the user to operate a mutable model.

If you use this explicitly, you need to: - register all stream components (Sources, Sinks, Connectors and Transforms) - connect all components together, so that no Source or Sink remains unconnected - build the runnable FutureStream.

Normally, however, this class remains implicit in the background. Each StreamComponent constructor creates a new instance of this class if an existing implicit value is not provided; every shortcut method (like Source.map) passes its own Builder instance as the implicit parameter to the new component it creates. All components and links are registered with the builder.

Whenever two different builder instances meet (by connecting two stream components that were created using separate builders), they become bidirectionally linked. Calling build on any of them takes all of them into account, and so it doesn't matter how the state produced by register and connect is initially distributed between them.

After calling build once, you can keep modifying the graph (this will not affect the previously built stream), and/or call build again, producing a separate stream. However, if any components are not reusable (e.g. any custom Func which is a closure over external mutable state), the behavior of the second and future streams will be undefined.

Linear Supertypes
LazyLogging, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. FutureStreamBuilder
  2. LazyLogging
  3. AnyRef
  4. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new FutureStreamBuilder()

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  5. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. def connect[In >: Out, Out](source: SourceComponent[Out], sink: SinkComponent[In]): Unit

    Irreversibly connects two components together, and links their builders if they are not yet linked.

  7. def describeGraph(): String

    Returns a multiline description of the current stream graph structure, useful for debugging.

  8. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  12. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  13. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  14. lazy val logger: Logger

    Attributes
    protected
    Definition Classes
    LazyLogging
  15. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  16. final def notify(): Unit

    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  18. def register(component: StreamComponent): Unit

    Adds this component to the graph.

    Adds this component to the graph. If it's already in the graph, it's a no-op.

    This doesn't link it to any other components; it's a safety measure that lets us detect any unconnected components when build is called.

  19. def run()(implicit ec: ExecutionContext): RunningStream

    Builds and starts a runnable FutureStream from the current graph.

  20. def runningStream: Future[RunningStream]

    Returns a Future that is fulfilled once run has been called.

    Returns a Future that is fulfilled once run has been called.

    This is useful because it allows the constructors of stream components to acquire the eventual stream and then link it to outside failure conditions by calling RunningStream.fail.

  21. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  22. def toString(): String

    Definition Classes
    AnyRef → Any
  23. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from LazyLogging

Inherited from AnyRef

Inherited from Any

Ungrouped