Queue

class Queue[F[_], T](maxSize: Int)(implicit evidence$1: Effect[F])

Nonblocking, concurrent, asynchronous queue.

Companion:
object
class Object
trait Matchable
class Any

Value members

Concrete methods

def canOffer: F[Unit]

Signals that queue size became less than maxSize.

Signals that queue size became less than maxSize.

Example:
def aux(): F[Unit] = queue.offer(o).flatMap {
 case false => queue.canOffer *> aux()
 case true => Effect[F].unit
}
aux()
def cancelSignal: F[Unit]

Resolves only if stream.cancel ran.

Resolves only if stream.cancel ran.

def close(): F[Unit]

Immediately stop offering and pulling items from the queue.

Immediately stop offering and pulling items from the queue.

def enqueue(item: T): F[Unit]

Enqueue item. If maxSize reached waits until queue will decrease.

Enqueue item. If maxSize reached waits until queue will decrease.

def fail(e: Throwable): F[Unit]
def failUnsafe(e: Throwable): Unit
def offer(item: T): F[Boolean]

Offers item to the queue.

Offers item to the queue.

Returns:

true is ok and false if maxSize reached or queue is stopped.

def offerUnsafe(item: T): Boolean

Strict version of offer. Still thread safe.

Strict version of offer. Still thread safe.

def size(): F[Int]

Returns the size of the queue. This property takes into account canOfferCallbacks and pullCallbacks to determine the real size of the queue after all of them are resolved.

Returns the size of the queue. This property takes into account canOfferCallbacks and pullCallbacks to determine the real size of the queue after all of them are resolved.

def stop(): F[Unit]

Disallow to offer new items. Stream ends with last item.

Disallow to offer new items. Stream ends with last item.

def unsafeClose(): Unit
def unsafeStop(): Unit

Concrete fields

val stream: Stream[F, T]