Package

com.github.mboogerd.streams

sorted

Permalink

package sorted

Visibility
  1. Public
  2. All

Type Members

  1. class Align[A, B] extends GraphStage[FanInShape2[A, B, Ior[A, B]]]

    Permalink

    Align zips together two streams based on a control function.

    Align zips together two streams based on a control function. The function allows one to control inputstream progress, by only progressing a stream of choice, or both streams simultaneously. Backpressure gets propagated accordingly.

  2. trait AlignedStreamOpsPrio2 extends AnyRef

    Permalink

  3. trait AlignedStreamsOps extends AlignedStreamOpsPrio2

    Permalink
  4. final class ContiguousGroupBy[T, K] extends GraphStage[FlowShape[T, (K, Source[T, NotUsed])]]

    Permalink

    A group-by specifically written for streams that are contiguous w.r.t.

    A group-by specifically written for streams that are contiguous w.r.t. the computed key. Sorted-stream is a sufficient, but not a necessary condition for this to work. Informally, what matters is that all elements that map to the same key form groups of consecutive elements, i.e:

    for-all s, t in inputstream, such that s precedes t directly: if keyFor(s) != keyFor(t), then: - there exists no element u in inputstream such that t precedes u (at any distance) s.t. keyFor(s) == keyFor(u); and, - there exists no element r in inputstream such that r precedes s (at any distance) s.t. keyFor(r) == keyFor(t).

    All groups of stream-elements are propagated to their own substream. What distinguishes this implementation from the typical group-by implementation is that sub-streams can be closed directly after witnessing a value that maps to a different key. The traditional group-by must keep all sub-streams open until the superstream is consumed, as only then it can guarantee that no more elements will be propagated to any of the sub-streams. Resources can be freed immediately, given the guarantee that no more elements will arrive for the substream.

    An contiguous approach (if the stream permits it) allows you to stay closer to business-semantics; There is no need to specify how many groups may be processed concurrently. Also, we have more (but not complete) freedom to wait in our superstream for completion of a substream, without introducing deadlocks. Both these permit us to use a declarative group-by, where otherwise this logic would be obfuscated by stream-management.

  5. trait ContiguousGroupByOps extends AnyRef

    Permalink

  6. trait SortedStreamUtil extends AlignedStreamsOps with ContiguousGroupByOps

    Permalink

    Provides utilities for united.sorted streams

Value Members

  1. object Align

    Permalink
  2. object AlignedStreamsOps extends AlignedStreamsOps

    Permalink
  3. object SortedStreamUtil extends SortedStreamUtil

    Permalink

Ungrouped