PQueueSource

cats.effect.std.PQueueSource
See thePQueueSource companion object
trait PQueueSource[F[_], A]

Attributes

Companion
object
Source
PQueue.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class PQueue[F, A]

Members list

Value members

Abstract methods

def size: F[Int]

Attributes

Source
PQueue.scala
def take: F[A]

Dequeues the least element from the PQueue, possibly fiber blocking until an element becomes available.

Dequeues the least element from the PQueue, possibly fiber blocking until an element becomes available.

O(log(n))

Note: If there are multiple elements with least priority, the order in which they are dequeued is undefined. If you want to break ties with FIFO order you will need an additional Ref[F, Long] to track insertion, and embed that information into your instance for Order[A].

Attributes

Source
PQueue.scala
def tryTake: F[Option[A]]

Attempts to dequeue the least element from the PQueue, if one is available without fiber blocking.

Attempts to dequeue the least element from the PQueue, if one is available without fiber blocking.

O(log(n))

Attributes

Returns

an effect that describes whether the dequeueing of an element from the PQueue succeeded without blocking, with None denoting that no element was available Note: If there are multiple elements with least priority, the order in which they are dequeued is undefined. If you want to break ties with FIFO order you will need an additional Ref[F, Long] to track insertion, and embed that information into your instance for Order[A].

Source
PQueue.scala

Concrete methods

def tryTakeN(maxN: Option[Int])(implicit F: Monad[F]): F[List[A]]

Attempts to dequeue elements from the PQueue, if they are available without semantically blocking.

Attempts to dequeue elements from the PQueue, if they are available without semantically blocking. This is a convenience method that recursively runs tryTake. It does not provide any additional performance benefits.

Value parameters

maxN

The max elements to dequeue. Passing None will try to dequeue the whole queue.

Attributes

Returns

an effect that contains the dequeued elements from the PQueue Note: If there are multiple elements with least priority, the order in which they are dequeued is undefined.

Source
PQueue.scala