abstract class Queue[F[_], A] extends AnyRef
Asynchronous queue interface. Operations are all nonblocking in their implementations, but may be 'semantically' blocking. For instance, a queue may have a bound on its size, in which case enqueuing may block until there is an offsetting dequeue.
- Self Type
- Queue[F, A]
- Source
- Queue.scala
- Alphabetic
- By Inheritance
- Queue
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Instance Constructors
- new Queue()
Abstract Value Members
-
abstract
def
available: immutable.Signal[F, Int]
Returns the available number of entries in the queue.
Returns the available number of entries in the queue. Always
Int.MaxValue
when the queue is unbounded. -
abstract
def
cancellableDequeue1: F[(F[A], F[Unit])]
Like
dequeue1
but provides a way to cancel the dequeue. -
abstract
def
cancellableDequeueBatch1(batchSize: Int): F[(F[Chunk[A]], F[Unit])]
Like
dequeueBatch1
but provides a way to cancel the dequeue. -
abstract
def
dequeue1: F[A]
Dequeues one
A
from this queue.Dequeues one
A
from this queue. Completes once one is ready. -
abstract
def
dequeueBatch1(batchSize: Int): F[Chunk[A]]
Dequeues at most
batchSize
A
s from this queue.Dequeues at most
batchSize
A
s from this queue. Completes once at least one value is ready. -
abstract
def
enqueue1(a: A): F[Unit]
Enqueues one element in this
Queue
.Enqueues one element in this
Queue
. If the queue isfull
this waits until queue is empty.This completes after
a
has been successfully enqueued to thisQueue
-
abstract
def
full: immutable.Signal[F, Boolean]
Returns
true
when the queue has reached its upper size bound.Returns
true
when the queue has reached its upper size bound. Alwaysfalse
when the queue is unbounded. -
abstract
def
offer1(a: A): F[Boolean]
Offers one element in this
Queue
.Offers one element in this
Queue
.Evaluates to
false
if the queue is full, indicating thea
was not queued up. Evaluates totrue
if thea
was queued up successfully.- a
A
to enqueue
-
abstract
def
peek1: F[A]
Returns the element which would be dequeued next, but without removing it.
Returns the element which would be dequeued next, but without removing it. Completes when such an element is available.
-
abstract
def
size: immutable.Signal[F, Int]
The time-varying size of this
Queue
.The time-varying size of this
Queue
. This signal refreshes only when size changes. Offsetting enqueues and de-queues may not result in refreshes. -
abstract
def
timedDequeue1(timeout: FiniteDuration, scheduler: Scheduler): F[Option[A]]
Like dequeue1 but limits the amount of time spent waiting for an element to be dequeued.
Like dequeue1 but limits the amount of time spent waiting for an element to be dequeued. If the element is dequeued before the timeout is reached, the element is returned wrapped in
Some
. Otherwise,None
is returned. -
abstract
def
timedDequeueBatch1(batchSize: Int, timeout: FiniteDuration, scheduler: Scheduler): F[Option[Chunk[A]]]
Like dequeueBatch1 but limits the amount of time spent waiting for a batch to be dequeued.
Like dequeueBatch1 but limits the amount of time spent waiting for a batch to be dequeued. If the batch is dequeued before the timeout is reached, the batch is returned wrapped in
Some
. Otherwise,None
is returned. -
abstract
def
timedEnqueue1(a: A, timeout: FiniteDuration, scheduler: Scheduler): F[Boolean]
Like enqueue1 but limits the amount of time spent waiting for the enqueue to complete.
Like enqueue1 but limits the amount of time spent waiting for the enqueue to complete. If the element is enqueued before the timeout is reached, true is returned. Otherwise, false is returned.
-
abstract
def
timedPeek1(timeout: FiniteDuration, scheduler: Scheduler): F[Option[A]]
Like peek1 but returns
None
if waiting for the element would need longer time thantimeout
. -
abstract
def
upperBound: Option[Int]
The size bound on the queue.
The size bound on the queue.
None
if the queue is unbounded.
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
- def +(other: String): String
- def ->[B](y: B): (Queue[F, A], B)
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
dequeue: Stream[F, A]
Repeatedly calls
dequeue1
forever. -
def
dequeueAvailable: Stream[F, A]
Calls
dequeueBatch1
forever, with a bound ofInt.MaxValue
-
def
dequeueBatch: Pipe[F, Int, A]
Calls
dequeueBatch1
once with a provided bound on the elements dequeued. -
def
enqueue: Sink[F, A]
Enqueues each element of the input stream to this
Queue
by callingenqueue1
on each element. - def ensuring(cond: (Queue[F, A]) ⇒ Boolean, msg: ⇒ Any): Queue[F, A]
- def ensuring(cond: (Queue[F, A]) ⇒ Boolean): Queue[F, A]
- def ensuring(cond: Boolean, msg: ⇒ Any): Queue[F, A]
- def ensuring(cond: Boolean): Queue[F, A]
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
- def formatted(fmtstr: String): String
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
imap[B](f: (A) ⇒ B)(g: (B) ⇒ A)(implicit F: Functor[F]): Queue[F, B]
Returns an alternate view of this
Queue
where its elements are of typeB
, given two functions,A => B
andB => A
. -
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
- def →[B](y: B): (Queue[F, A], B)