Packages

sealed trait Channel[F[_], A] extends AnyRef

Stream aware, multiple producer, single consumer closeable channel.

Source
Channel.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Channel
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def close: F[Either[Closed, Unit]]

    This method achieves graceful shutdown: when the channel gets closed, stream will terminate naturally after consuming all currently enqueued elements, including the ones by producers blocked on a bound.

    This method achieves graceful shutdown: when the channel gets closed, stream will terminate naturally after consuming all currently enqueued elements, including the ones by producers blocked on a bound.

    "Termination" here means that stream will no longer wait for new elements on the channel, and not that it will be interrupted while performing another action: if you want to interrupt stream immediately, without first processing enqueued elements, you should use interruptWhen on it instead.

    After a call to close, any further calls to send or close will be no-ops.

    Note that close does not automatically unblock producers which might be blocked on a bound, they will only become unblocked if stream is executing.

    In other words, if close is called while stream is executing, blocked producers will eventually become unblocked, before stream terminates and further send calls become no-ops. However, if close is called after stream has terminated (e.g because it was interrupted, or had a .take(n)), then blocked producers will stay blocked unless they get explicitly unblocked, either by a further call to stream to drain the channel, or by a a race with closed.

  2. abstract def closed: F[Unit]

    Semantically blocks until the channel gets closed.

  3. abstract def isClosed: F[Boolean]

    Returns true if this channel is closed

  4. abstract def send(a: A): F[Either[Closed, Unit]]

    Sends an element through this channel.

    Sends an element through this channel.

    It can be called concurrently by multiple producers, and it may semantically block if the channel is bounded or synchronous.

    No-op if the channel is closed, see close for further info.

  5. abstract def sendAll: Pipe[F, A, Nothing]

    Sends all the elements of the input stream through this channel, and closes it after.

    Sends all the elements of the input stream through this channel, and closes it after. Especially useful if the channel is single producer.

  6. abstract def stream: Stream[F, A]

    The stream of elements sent through this channel.

    The stream of elements sent through this channel. It terminates if close is called and all elements in the channel have been emitted (see close for futher info).

    This method CANNOT be called concurrently by multiple consumers, if you do so, one of the consumers might become permanently deadlocked.

    It is possible to call stream again once the previous one has terminated, but be aware that some element might get lost in the process, e.g if the first call to stream got 5 elements off the channel, and terminated after emitting 2, when the second call to stream starts it won't see those 3 elements.

    Every time stream is pulled, it will serve all the elements that are queued up in a single chunk, including those from producers that might be semantically blocked on a bounded channel, which will then become unblocked. That is, a bound on a channel represents the maximum number of elements that can be queued up before a producer blocks, and not the maximum number of elements that will be received by stream at once.

  7. abstract def trySend(a: A): F[Either[Closed, Boolean]]

    Attempts to send an element through this channel, and indicates if it succeeded (true) or not (false).

    Attempts to send an element through this channel, and indicates if it succeeded (true) or not (false).

    It can be called concurrently by multiple producers, and it may not succeed if the channel is bounded or synchronous. It will never semantically block.

    No-op if the channel is closed, see close for further info.

Concrete 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[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  9. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  10. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  11. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  13. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  14. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  15. def toString(): String
    Definition Classes
    AnyRef → Any
  16. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  17. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  18. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from AnyRef

Inherited from Any

Ungrouped