Trait

org.specs2.codata.async.mutable

Queue

Related Doc: package mutable

Permalink

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.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Queue
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def dequeue: Process[Task, A]

    Permalink

    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 Topic instead of Queue when all subscribers need to see each value enqueued.

    This process is equivalent to dequeueBatch(1).

  2. abstract def dequeueAvailable: Process[Task, Seq[A]]

    Permalink

    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.

  3. abstract def dequeueBatch(limit: Int): Process[Task, Seq[A]]

    Permalink

    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 single Seq. Note that this naturally does not *guarantee* that limit items 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.

  4. abstract def enqueue: Sink[Task, A]

    Permalink

    A Sink for enqueueing values to this Queue.

  5. abstract def enqueueAll(xa: Seq[A]): Task[Unit]

    Permalink

    Enqueue multiple A values in this queue.

    Enqueue multiple A values in this queue. This has same semantics as sequencing repeated calls to enqueueOne.

  6. abstract def enqueueOne(a: A): Task[Unit]

    Permalink

    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_ a has been successfully enqueued.

    a

    A to enqueue

  7. abstract def size: immutable.Signal[Int]

    Permalink

    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.

  8. abstract def upperBound: Option[Int]

    Permalink

    The size bound on the queue.

    The size bound on the queue. Returns None if the queue is unbounded.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def available: immutable.Signal[Int]

    Permalink

    Returns the available number of entries in the queue.

    Returns the available number of entries in the queue. Always returns Int.MaxValue when the queue is unbounded.

  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def close: Task[Unit]

    Permalink

    Closes this queue.

    Closes this queue. This halts the enqueue Sink and dequeue Process after any already-queued elements are drained.

    After this any enqueue will fail with Terminated(End), and the enqueue Sink will terminate with End.

  8. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  10. def fail(rsn: Throwable): Task[Unit]

    Permalink

    Like kill, except it terminates with supplied reason.

  11. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. def full: immutable.Signal[Boolean]

    Permalink

    Returns true when the queue has reached its upper size bound.

    Returns true when the queue has reached its upper size bound. Always returns false when the queue is unbounded.

  13. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  14. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  15. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  16. def kill: Task[Unit]

    Permalink

    Kills the queue.

    Kills the queue. Unlike close, this kills all dequeuers immediately. Any subsequent enqueues will fail with Terminated(Kill). The returned Task will completed once all dequeuers and enqueuers have been signalled.

  17. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  18. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  20. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  21. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  22. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped