trait Queue[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.
- Source
- Queue.scala
- Alphabetic
- By Inheritance
- Queue
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
dequeue: Process[Task, A]
Provides a process that dequeue from this queue.
Provides a process that dequeue from this queue. When multiple consumers dequeue from this queue, they dequeue in first-come, first-serve order.
Please use
Topicinstead ofQueuewhen all subscribers need to see each value enqueued.This process is equivalent to
dequeueBatch(1). -
abstract
def
dequeueAvailable: Process[Task, Seq[A]]
Equivalent to dequeueBatch with an infinite limit.
Equivalent to dequeueBatch with an infinite limit. Only use this method if your underlying algebra (
A) has some sort of constant time "natural batching"! If processing a chunk of size n is linearly more expensive than processing a chunk of size 1, you should always use dequeueBatch with some small limit, otherwise you will disrupt fairness in the nondeterministic merge combinators. -
abstract
def
dequeueBatch(limit: Int): Process[Task, Seq[A]]
Provides a process that dequeues in chunks.
Provides a process that dequeues in chunks. Whenever *n* elements are available in the queue,
min(n, limit)elements will be dequeud and produced as a singleSeq. Note that this naturally does not *guarantee* thatlimititems are returned in every chunk. If only one element is available, that one element will be returned in its own sequence. This method basically just allows a consumer to "catch up" to a rapidly filling queue in the case where some sort of batching logic is applicable. -
abstract
def
enqueue: Sink[Task, A]
A
Sinkfor enqueueing values to thisQueue. -
abstract
def
enqueueAll(xa: Seq[A]): Task[Unit]
Enqueue multiple
Avalues in this queue.Enqueue multiple
Avalues in this queue. This has same semantics as sequencing repeated calls toenqueueOne. -
abstract
def
enqueueOne(a: A): Task[Unit]
Enqueue one element in this
Queue.Enqueue one element in this
Queue. Resulting task will terminate with failure if queue is closed or failed. Please note this will get completed _after_ahas been successfully enqueued.- a
Ato enqueue
-
abstract
def
size: immutable.Signal[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 dequeues may not result in refreshes. -
abstract
def
upperBound: Option[Int]
The size bound on the queue.
The size bound on the queue. Returns 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[A], B)
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
available: immutable.Signal[Int]
Returns the available number of entries in the queue.
Returns the available number of entries in the queue. Always returns
Int.MaxValuewhen the queue is unbounded. -
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
close: Task[Unit]
Closes this queue.
Closes this queue. This halts the
enqueueSinkanddequeueProcessafter any already-queued elements are drained.After this any enqueue will fail with
Terminated(End), and the enqueueSinkwill terminate withEnd. - def ensuring(cond: (Queue[A]) ⇒ Boolean, msg: ⇒ Any): Queue[A]
- def ensuring(cond: (Queue[A]) ⇒ Boolean): Queue[A]
- def ensuring(cond: Boolean, msg: ⇒ Any): Queue[A]
- def ensuring(cond: Boolean): Queue[A]
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
fail(rsn: Throwable): Task[Unit]
Like
kill, except it terminates with supplied reason. -
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
- def formatted(fmtstr: String): String
-
def
full: immutable.Signal[Boolean]
Returns
truewhen the queue has reached its upper size bound.Returns
truewhen the queue has reached its upper size bound. Always returnsfalsewhen the queue is unbounded. -
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
kill: Task[Unit]
Kills the queue.
Kills the queue. Unlike
close, this kills all dequeuers immediately. Any subsequent enqueues will fail withTerminated(Kill). The returnedTaskwill completed once all dequeuers and enqueuers have been signalled. -
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
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
- @throws( ... )
- def →[B](y: B): (Queue[A], B)