Trait

colossus.streaming

Pipe

Related Doc: package streaming

Permalink

trait Pipe[I, O] extends Sink[I] with Source[O]

A Pipe is an abstraction that mediates interactions between producers and consumers of a stream of data. It can be thought of as a mutable buffer that has built-in features for addressing both back-pressure (when the pipe "fills") and forward-pressure (when the pipe "empties"). Items are "pushed" into the pipe and "pulled" out of it.

A Pipe is the combination of the Source and Sink traits, representing the producer and consumer interfaces, respectively. It should be noted that a Pipe does not contain additional state beyond that provided by the Source and Sink interfaces. In other words, it may be possible for the producer Sink side of a pipe to be Closed or Terminated, while the consumer Source side is in a different state.

The canonical implementation is the BufferedPipe, backed by a fixed-length buffer. However pipes have many monadic and combinatorial capabilities, allowing them to be mapped, linked together, flattened, and multiplexed.

As opposed to other libraries/frameworks that have a concept of streams, sources, and sinks, these pipes are intended for low-level stream management. They support several features that allow interation with pipes to be very fast and efficient. They form the backbone of all connection handlers and as well as streaming protocols like http/2. Pipes are *not* thread-safe.

Linear Supertypes
Source[O], Sink[I], Transport, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Pipe
  2. Source
  3. Sink
  4. Transport
  5. AnyRef
  6. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def complete(): Try[Unit]

    Permalink
    Definition Classes
    Sink
  2. abstract def inputState: TransportState

    Permalink
    Definition Classes
    Sink
  3. abstract def outputState: TransportState

    Permalink
    Definition Classes
    Source
  4. abstract def peek: PullResult[O]

    Permalink
    Definition Classes
    Source
  5. abstract def pull(): PullResult[O]

    Permalink

    Pull the next item from the Source if available.

    Pull the next item from the Source if available. The returned PullResult will indicate whether an item was successfully pulled.

    Definition Classes
    Source
  6. abstract def pullWhile(fn: (O) ⇒ PullAction, onComplete: (TerminalPullResult) ⇒ Any): Unit

    Permalink

    Repeatedly pull items out of a pipe, even if items are not immediately available.

    Repeatedly pull items out of a pipe, even if items are not immediately available. The Source will hold onto the given processing function and immediately forward items into it as they become available. The returned PullAction determines how the Source will proceed with the next item. If PullContinue or Wait are returned, the Source will hold onto the processing function for either when the next item is available or when the returned Signal is fired. onComplete is only called if the Source is closed or terminated while the processing function is in use.

    When Wait is returned, the item that was passed into the processing function is _not_ pulled from the source. Thus when the returned signal is fired and processing resumes, the same item will be passed to the processing function.

    This method is generally intended for linking the output of a Source to the input of a Sink. For a simplified version of this functionality, see Source.into.

    Definition Classes
    Source
  7. abstract def push(item: I): PushResult

    Permalink
    Definition Classes
    Sink
  8. abstract def pushPeek: PushResult

    Permalink
    Definition Classes
    Sink
  9. abstract def terminate(reason: Throwable): Unit

    Permalink

    Immediately terminate the transport, permenantly putting it into an error state

    Immediately terminate the transport, permenantly putting it into an error state

    Definition Classes
    Transport

Concrete Value Members

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  3. def ++[U >: O](next: Source[U]): Source[U]

    Permalink
    Definition Classes
    Source
  4. final def ==(arg0: Any): Boolean

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

    Permalink
    Definition Classes
    Any
  6. def canPullNonEmpty: Boolean

    Permalink
    Definition Classes
    Source
  7. def canPush: Boolean

    Permalink
    Definition Classes
    Sink
  8. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def collected: Callback[Iterator[O]]

    Permalink
    Definition Classes
    Source
  10. final def eq(arg0: AnyRef): Boolean

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

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. def fold[U](init: U)(cb: (O, U) ⇒ U): Callback[U]

    Permalink
    Definition Classes
    Source
  14. def foldWhile[U](init: U)(cb: (O, U) ⇒ U)(f: (U) ⇒ Boolean): Callback[U]

    Permalink
    Definition Classes
    Source
  15. final def getClass(): Class[_]

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

    Permalink
    Definition Classes
    AnyRef → Any
  17. def into[X >: O](sink: Sink[X]): Unit

    Permalink
    Definition Classes
    Source
  18. def into[X >: O](sink: Sink[X], linkClosed: Boolean, linkTerminated: Boolean)(onComplete: (NonOpenTransportState) ⇒ Any): Unit

    Permalink

    Link this source to a sink.

    Link this source to a sink. Items will be pulled from the source and pushed to the sink, respecting backpressure, until either the source is closed or an error occurs. The linkClosed and linkTerminated parameters determine whether to propagate closure/termination of this Source to the linked Sink. However if the sink is closed or terminated first, this source will be terminated.

    sink

    The sink to link to this source

    linkClosed

    if true, the linked sink will be closed when this source is closed

    linkTerminated

    if true, the linked sink will be terminated when this source is terminated

    Definition Classes
    Source
  19. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  20. def mapIn[A](f: (A) ⇒ I): Sink[A]

    Permalink
    Definition Classes
    Sink
  21. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  22. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  23. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  24. def pull(whenReady: (Try[Option[O]]) ⇒ Unit): Unit

    Permalink
    Definition Classes
    Source
  25. def pullCB(): Callback[Option[O]]

    Permalink
    Definition Classes
    Source
  26. def pullUntilNull(fn: (O) ⇒ Boolean): Option[NullPullResult]

    Permalink

    Pull until either the supplied function returns false or there are no more items immediately available to pull, in which case a Some[NullPullResult] is returned indicating why the loop stopped.

    Pull until either the supplied function returns false or there are no more items immediately available to pull, in which case a Some[NullPullResult] is returned indicating why the loop stopped.

    Definition Classes
    Source
  27. def reduce[U >: O](reducer: (U, U) ⇒ U): Callback[U]

    Permalink
    Definition Classes
    Source
  28. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  29. def toString(): String

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

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  33. def weld[U >: O, T](next: Pipe[U, T]): Pipe[I, T]

    Permalink

Inherited from Source[O]

Inherited from Sink[I]

Inherited from Transport

Inherited from AnyRef

Inherited from Any

Ungrouped