trait ZQueue[-RA, +EA, -RB, +EB, -A, +B] extends Serializable
A ZQueue[RA, EA, RB, EB, A, B]
is a lightweight, asynchronous queue into which values of
type A
can be enqueued and of which elements of type B
can be dequeued. The queue's
enqueueing operations may utilize an environment of type RA
and may fail with errors of
type EA
. The dequeueing operations may utilize an environment of type RB
and may fail
with errors of type EB
.
- Self Type
- ZQueue[RA, EA, RB, EB, A, B]
- Alphabetic
- By Inheritance
- ZQueue
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
awaitShutdown: UIO[Unit]
Waits until the queue is shutdown.
Waits until the queue is shutdown. The
IO
returned by this method will not resume until the queue has been shutdown. If the queue is already shutdown, theIO
will resume right away. -
abstract
def
capacity: Int
How many elements can hold in the queue
-
abstract
def
isShutdown: UIO[Boolean]
true
ifshutdown
has been called. -
abstract
def
offer(a: A): ZIO[RA, EA, Boolean]
Places one value in the queue.
-
abstract
def
offerAll(as: Iterable[A]): ZIO[RA, EA, Boolean]
For Bounded Queue: uses the
BackPressure
Strategy, places the values in the queue and returns always true If the queue has reached capacity, then the fiber performing theofferAll
will be suspended until there is room in the queue.For Bounded Queue: uses the
BackPressure
Strategy, places the values in the queue and returns always true If the queue has reached capacity, then the fiber performing theofferAll
will be suspended until there is room in the queue.For Unbounded Queue: Places all values in the queue and returns true.
For Sliding Queue: uses
Sliding
Strategy If there is a room in the queue, it places the values and returns true otherwise it removed the old elements and enqueues the new onesFor Dropping Queue: uses
Dropping
Strategy, It places the values in the queue but if there is no room it will not enqueue them and returns false -
abstract
def
shutdown: UIO[Unit]
Interrupts any fibers that are suspended on
offer
ortake
.Interrupts any fibers that are suspended on
offer
ortake
. Future calls tooffer*
andtake*
will be interrupted immediately. -
abstract
def
size: UIO[Int]
Retrieves the size of the queue, which is equal to the number of elements in the queue.
Retrieves the size of the queue, which is equal to the number of elements in the queue. This may be negative if fibers are suspended waiting for elements to be added to the queue.
-
abstract
def
take: ZIO[RB, EB, B]
Removes the oldest value in the queue.
Removes the oldest value in the queue. If the queue is empty, this will return a computation that resumes when an item has been added to the queue.
-
abstract
def
takeAll: ZIO[RB, EB, List[B]]
Removes all the values in the queue and returns the list of the values.
Removes all the values in the queue and returns the list of the values. If the queue is empty returns empty list.
-
abstract
def
takeUpTo(max: Int): ZIO[RB, EB, List[B]]
Takes up to max number of values in the queue.
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
def
&&[RA1 <: RA, EA1 >: EA, A1 <: A, RB1 <: RB, EB1 >: EB, C, D](that: ZQueue[RA1, EA1, RB1, EB1, A1, C]): ZQueue[RA1, EA1, RB1, EB1, A1, (B, C)]
Alias for
both
. -
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
both[RA1 <: RA, EA1 >: EA, A1 <: A, RB1 <: RB, EB1 >: EB, C, D](that: ZQueue[RA1, EA1, RB1, EB1, A1, C]): ZQueue[RA1, EA1, RB1, EB1, A1, (B, C)]
Like
bothWith
, but tuples the elements instead of applying a function. -
def
bothWith[RA1 <: RA, EA1 >: EA, A1 <: A, RB1 <: RB, EB1 >: EB, C, D](that: ZQueue[RA1, EA1, RB1, EB1, A1, C])(f: (B, C) ⇒ D): ZQueue[RA1, EA1, RB1, EB1, A1, D]
Like
bothWithM
, but uses a pure function. -
def
bothWithM[RA1 <: RA, EA1 >: EA, A1 <: A, RB1 <: RB, EB1 >: EB, C, R3 <: RB1, E3 >: EB1, D](that: ZQueue[RA1, EA1, RB1, EB1, A1, C])(f: (B, C) ⇒ ZIO[R3, E3, D]): ZQueue[RA1, EA1, R3, E3, A1, D]
Creates a new queue from this queue and another.
Creates a new queue from this queue and another. Offering to the composite queue will broadcast the elements to both queues; taking from the composite queue will dequeue elements from both queues and apply the function point-wise.
Note that using queues with different strategies may result in surprising behavior. For example, a dropping queue and a bounded queue composed together may apply
f
to different elements. -
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
contramap[C](f: (C) ⇒ A): ZQueue[RA, EA, RB, EB, C, B]
Transforms elements enqueued into this queue with a pure function.
-
def
contramapM[RA2 <: RA, EA2 >: EA, C](f: (C) ⇒ ZIO[RA2, EA2, A]): ZQueue[RA2, EA2, RB, EB, C, B]
Transforms elements enqueued into this queue with an effectful function.
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
filterInput[A1 <: A](f: (A1) ⇒ Boolean): ZQueue[RA, EA, RB, EB, A1, B]
Applies a filter to elements enqueued into this queue.
Applies a filter to elements enqueued into this queue. Elements that do not pass the filter will be immediately dropped.
-
def
filterInputM[R2 <: RA, E2 >: EA, A1 <: A](f: (A1) ⇒ ZIO[R2, E2, Boolean]): ZQueue[R2, E2, RB, EB, A1, B]
Like
filterInput
, but uses an effectful function to filter the elements. -
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def map[C](f: (B) ⇒ C): ZQueue[RA, EA, RB, EB, A, C]
-
def
mapM[R2 <: RB, E2 >: EB, C](f: (B) ⇒ ZIO[R2, E2, C]): ZQueue[RA, EA, R2, E2, A, C]
Transforms elements dequeued from this queue with an effectful function.
-
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
poll: ZIO[RB, EB, Option[B]]
Take the head option of values in the queue.
-
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( ... )