FlowCompanionOps

ox.flow.FlowCompanionOps

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Flow
Self type
Flow.type

Members list

Value members

Concrete methods

def concat[T](flows: Seq[Flow[T]]): Flow[T]

Creates a flow which concatenates the given flows in order. First elements from the first flow are emitted, then from the second etc. If any of the flows compeltes with an error, is is propagated.

Creates a flow which concatenates the given flows in order. First elements from the first flow are emitted, then from the second etc. If any of the flows compeltes with an error, is is propagated.

Attributes

def empty[T]: Flow[T]

Creates an empty flow, which emits no elements and completes immediately.

Creates an empty flow, which emits no elements and completes immediately.

Attributes

def failed[T](t: Throwable): Flow[T]

Creates a flow that fails immediately with the given java.lang.Throwable

Creates a flow that fails immediately with the given java.lang.Throwable

Value parameters

t

The java.lang.Throwable to fail with

Attributes

def fromFork[T](f: Fork[T]): Flow[T]

Creates a flow from the given fork. The flow will emit up to one element, or complete by throwing an exception if the fork fails.

Creates a flow from the given fork. The flow will emit up to one element, or complete by throwing an exception if the fork fails.

Attributes

def fromFuture[T](from: Future[T]): Flow[T]

Creates a flow that emits a single element when from completes, or throws an exception when from fails.

Creates a flow that emits a single element when from completes, or throws an exception when from fails.

Attributes

def fromFutureSource[T](from: Future[Source[T]]): Flow[T]

Creates a flow that emits all elements from the given future Source when from completes.

Creates a flow that emits all elements from the given future Source when from completes.

Attributes

def fromIterable[T](it: Iterable[T]): Flow[T]

Creates a flow from the given iterable. Each element of the iterable is emitted in order.

Creates a flow from the given iterable. Each element of the iterable is emitted in order.

Attributes

def fromIterator[T](it: => Iterator[T]): Flow[T]

Creates a flow from the given (lazily evaluated) iterator. Each element of the iterator is emitted in order.

Creates a flow from the given (lazily evaluated) iterator. Each element of the iterator is emitted in order.

Attributes

def fromSource[T](source: Source[T]): Flow[T]

Creates a flow using the given source. An element is emitted for each value received from the source. If the source is completed with an error, is it propagated by throwing.

Creates a flow using the given source. An element is emitted for each value received from the source. If the source is completed with an error, is it propagated by throwing.

Attributes

def fromValues[T](ts: T*): Flow[T]

Creates a flow from the given values. Each value is emitted in order.

Creates a flow from the given values. Each value is emitted in order.

Attributes

def interleaveAll[T](flows: Seq[Flow[T]], segmentSize: Int, eagerComplete: Boolean)(using BufferCapacity): Flow[T]

Sends a given number of elements (determined byc segmentSize) from each flow in flows to the returned flow and repeats. The order of elements in all flows is preserved.

Sends a given number of elements (determined byc segmentSize) from each flow in flows to the returned flow and repeats. The order of elements in all flows is preserved.

If any of the flows is done before the others, the behavior depends on the eagerCancel flag. When set to true, the returned flow is completed immediately, otherwise the interleaving continues with the remaining non-completed flows. Once all but one flows are complete, the elements of the remaining non-complete flow are emitted by the returned flow.

The provided flows are run concurrently and asynchronously.

Value parameters

eagerComplete

If true, the returned flow is completed as soon as any of the flows completes. If false, the interleaving continues with the remaining non-completed flows.

flows

The flows whose elements will be interleaved.

segmentSize

The number of elements sent from each flow before switching to the next one. Default is 1.

Attributes

def iterate[T](zero: T)(f: T => T): Flow[T]

Creates a flow which emits elements starting with zero, and then applying f to the previous element to get the next one.

Creates a flow which emits elements starting with zero, and then applying f to the previous element to get the next one.

Attributes

def range(from: Int, to: Int, step: Int): Flow[Int]

Creates a flow which emits a range of numbers, from from, to to (inclusive), stepped by step.

Creates a flow which emits a range of numbers, from from, to to (inclusive), stepped by step.

Attributes

def repeat[T](element: T): Flow[T]

Creates a flow, which emits the given element repeatedly.

Creates a flow, which emits the given element repeatedly.

Attributes

def repeatEval[T](f: => T): Flow[T]

Creates a flow, which emits the result of evaluating f repeatedly. As the parameter is passed by-name, the evaluation is deferred until the element is emitted, and happens multiple times.

Creates a flow, which emits the result of evaluating f repeatedly. As the parameter is passed by-name, the evaluation is deferred until the element is emitted, and happens multiple times.

Value parameters

f

The code block, computing the element to emit.

Attributes

def repeatEvalWhileDefined[T](f: => Option[T]): Flow[T]

Creates a flow, which emits the value contained in the result of evaluating f repeatedly. When the evaluation of f returns a None, the flow is completed as "done", and no more values are evaluated or emitted.

Creates a flow, which emits the value contained in the result of evaluating f repeatedly. When the evaluation of f returns a None, the flow is completed as "done", and no more values are evaluated or emitted.

As the f parameter is passed by-name, the evaluation is deferred until the element is emitted, and happens multiple times.

Value parameters

f

The code block, computing the optional element to emit.

Attributes

def tick[T](interval: FiniteDuration, value: T): Flow[T]

Creates a flow which emits the given value repeatedly, at least interval apart between each two elements. The first value is emitted immediately.

Creates a flow which emits the given value repeatedly, at least interval apart between each two elements. The first value is emitted immediately.

The interval is measured between subsequent emissions. Hence, if the following transformation pipeline is slow, the next emission can occur immediately after the previous one is fully processed (if processing took more than the inter-emission interval duration). However, ticks do not accumulate; for example, if processing is slow enough that multiple intervals pass between send invocations, only one tick will be sent.

Value parameters

interval

The temporal spacing between subsequent ticks.

value

The element to emitted on every tick.

Attributes

def timeout[T](timeout: FiniteDuration): Flow[T]

Create a flow which sleeps for the given timeout and then completes as done.

Create a flow which sleeps for the given timeout and then completes as done.

Attributes

def unfold[S, T](initial: S)(f: S => Option[(T, S)]): Flow[T]

Creates a flow which emits the first element of tuples returned by repeated applications of f. The initial state is used for the first application, and then the state is updated with the second element of the tuple. Emission stops when f returns None, otherwise it continues indefinitely.

Creates a flow which emits the first element of tuples returned by repeated applications of f. The initial state is used for the first application, and then the state is updated with the second element of the tuple. Emission stops when f returns None, otherwise it continues indefinitely.

Attributes

def usingEmit[T](withEmit: (FlowEmit[T]) => Unit): Flow[T]

Creates a flow, which when run, provides a FlowEmit instance to the given withEmit function. Elements can be emitted to be processed by downstream stages by calling FlowEmit.apply.

Creates a flow, which when run, provides a FlowEmit instance to the given withEmit function. Elements can be emitted to be processed by downstream stages by calling FlowEmit.apply.

The FlowEmit instance provided to the withEmit callback should only be used on the calling thread. That is, FlowEmit is thread-unsafe. Moreover, the instance should not be stored or captured in closures, which outlive the invocation of withEmit.

Attributes