abstract class ZQueue[-RA, -RB, +EA, +EB, -A, +B] extends Serializable
A ZQueue[RA, RB, EA, 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, RB, EA, EB, A, B]
- Alphabetic
- By Inheritance
- ZQueue
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new ZQueue()
Abstract Value Members
-
abstract
def
awaitShutdown(implicit trace: ZTraceElement): 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(implicit trace: ZTraceElement): UIO[Boolean]
true
ifshutdown
has been called. -
abstract
def
offer(a: A)(implicit trace: ZTraceElement): ZIO[RA, EA, Boolean]
Places one value in the queue.
-
abstract
def
offerAll(as: Iterable[A])(implicit trace: ZTraceElement): ZIO[RA, EA, Boolean]
For Bounded Queue: uses the
BackPressure
Strategy, places the values in the queue and always returns true.For Bounded Queue: uses the
BackPressure
Strategy, places the values in the queue and always returns 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 room in the queue, it places the values otherwise it removes the old elements and enqueues the new ones. Always returns true.For Dropping Queue: uses
Dropping
Strategy, It places the values in the queue but if there is no room it will not enqueue them and return false. -
abstract
def
shutdown(implicit trace: ZTraceElement): 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(implicit trace: ZTraceElement): 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(implicit trace: ZTraceElement): 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(implicit trace: ZTraceElement): ZIO[RB, EB, Chunk[B]]
Removes all the values in the queue and returns the values.
Removes all the values in the queue and returns the values. If the queue is empty returns an empty collection.
-
abstract
def
takeUpTo(max: Int)(implicit trace: ZTraceElement): ZIO[RB, EB, Chunk[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
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
contramap[C](f: (C) ⇒ A): ZQueue[RA, RB, EA, EB, C, B]
Transforms elements enqueued into this queue with a pure function.
-
final
def
contramapZIO[RA2 <: RA, EA2 >: EA, C](f: (C) ⇒ ZIO[RA2, EA2, A]): ZQueue[RA2, RB, EA2, EB, C, B]
Transforms elements enqueued into this queue with an effectful function.
-
final
def
dimap[C, D](f: (C) ⇒ A, g: (B) ⇒ D): ZQueue[RA, RB, EA, EB, C, D]
Transforms elements enqueued into and dequeued from this queue with the specified pure functions.
-
final
def
dimapZIO[RC <: RA, RD <: RB, EC >: EA, ED >: EB, C, D](f: (C) ⇒ ZIO[RC, EC, A], g: (B) ⇒ ZIO[RD, ED, D]): ZQueue[RC, RD, EC, ED, C, D]
Transforms elements enqueued into and dequeued from this queue with the specified effectual functions.
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
filterInput[A1 <: A](f: (A1) ⇒ Boolean): ZQueue[RA, RB, EA, 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.
-
final
def
filterInputZIO[R2 <: RA, E2 >: EA, A1 <: A](f: (A1) ⇒ ZIO[R2, E2, Boolean]): ZQueue[R2, RB, E2, EB, A1, B]
Like
filterInput
, but uses an effectful function to filter the elements. -
final
def
filterOutput(f: (B) ⇒ Boolean): ZQueue[RA, RB, EA, EB, A, B]
Filters elements dequeued from the queue using the specified predicate.
-
def
filterOutputZIO[RB1 <: RB, EB1 >: EB](f: (B) ⇒ ZIO[RB1, EB1, Boolean]): ZQueue[RA, RB1, EA, EB1, A, B]
Filters elements dequeued from the queue using the specified effectual predicate.
-
def
finalize(): Unit
- Attributes
- protected[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
isEmpty(implicit trace: ZTraceElement): UIO[Boolean]
Checks whether the queue is currently empty.
-
final
def
isFull(implicit trace: ZTraceElement): UIO[Boolean]
Checks whether the queue is currently full.
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
map[C](f: (B) ⇒ C): ZQueue[RA, RB, EA, EB, A, C]
Transforms elements dequeued from this queue with a function.
-
final
def
mapZIO[R2 <: RB, E2 >: EB, C](f: (B) ⇒ ZIO[R2, E2, C]): ZQueue[RA, R2, EA, 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(implicit trace: ZTraceElement): ZIO[RB, EB, Option[B]]
Take the head option of values in the queue.
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
final
def
takeBetween(min: Int, max: Int)(implicit trace: ZTraceElement): ZIO[RB, EB, Chunk[B]]
Takes a number of elements from the queue between the specified minimum and maximum.
Takes a number of elements from the queue between the specified minimum and maximum. If there are fewer than the minimum number of elements available, suspends until at least the minimum number of elements have been collected.
-
final
def
takeN(n: Int)(implicit trace: ZTraceElement): ZIO[RB, EB, Chunk[B]]
Takes the specified number of elements from the queue.
Takes the specified number of elements from the queue. If there are fewer than the specified number of elements available, it suspends until they become available.
-
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( ... ) @native()
Deprecated Value Members
-
final
def
contramapM[RA2 <: RA, EA2 >: EA, C](f: (C) ⇒ ZIO[RA2, EA2, A]): ZQueue[RA2, RB, EA2, EB, C, B]
Transforms elements enqueued into this queue with an effectful function.
Transforms elements enqueued into this queue with an effectful function.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use contramapZIO
-
final
def
dimapM[RC <: RA, RD <: RB, EC >: EA, ED >: EB, C, D](f: (C) ⇒ ZIO[RC, EC, A], g: (B) ⇒ ZIO[RD, ED, D]): ZQueue[RC, RD, EC, ED, C, D]
Transforms elements enqueued into and dequeued from this queue with the specified effectual functions.
Transforms elements enqueued into and dequeued from this queue with the specified effectual functions.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use dimapZIO
-
final
def
filterInputM[R2 <: RA, E2 >: EA, A1 <: A](f: (A1) ⇒ ZIO[R2, E2, Boolean]): ZQueue[R2, RB, E2, EB, A1, B]
Like
filterInput
, but uses an effectful function to filter the elements.Like
filterInput
, but uses an effectful function to filter the elements.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use filterInputZIO
-
def
filterOutputM[RB1 <: RB, EB1 >: EB](f: (B) ⇒ ZIO[RB1, EB1, Boolean]): ZQueue[RA, RB1, EA, EB1, A, B]
Filters elements dequeued from the queue using the specified effectual predicate.
Filters elements dequeued from the queue using the specified effectual predicate.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use filterOutputZIO
-
final
def
mapM[R2 <: RB, E2 >: EB, C](f: (B) ⇒ ZIO[R2, E2, C]): ZQueue[RA, R2, EA, E2, A, C]
Transforms elements dequeued from this queue with an effectful function.
Transforms elements dequeued from this queue with an effectful function.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use mapZIO