fs2.aws.core

package fs2.aws.core

Value members

Concrete methods

def groupBy[F[_], A, K](selector: A => F[K])(implicit F: Concurrent[F]): (F, A) => (K, Stream[F, A])

Helper flow to group elements of a stream into K substreams. Grows with the number of distinct 'K' selectors

Helper flow to group elements of a stream into K substreams. Grows with the number of distinct 'K' selectors

Start with an empty Map of keys to queues On element received, invoke the selector function to yield the key denoting which queue this element belongs to If we already have an existing queue for that respective key, append the element lifted in an Option to the queue If a queue for that key does not exist, create a new queue, append it to the queue mapping, and then enqueue the element lifted in an Option For each queue, drain the queue yielding a stream of elements After the stream has been emptied, enqueue a single None to the queue so that the stream halts

Type parameters:
F

effect type of the fs2 stream

Value parameters:
selector

partitioning function based on the element

Returns:

a FS2 pipe producing a new sub-stream of elements grouped by the selector