CHub

sealed abstract class CHub[F[_], -A, +B] extends Serializable

A CHub[F, A, B] is an asynchronous message hub. Publishers can publish messages of type A to the hub and subscribers can subscribe to take messages of type B from the hub within the context of the effect F.

A CHub[F, A, B] is an asynchronous message hub. Publishers can publish messages of type A to the hub and subscribers can subscribe to take messages of type B from the hub within the context of the effect F.

Companion
object
trait Serializable
class Object
trait Matchable
class Any

Value members

Abstract methods

def awaitShutdown: F[Unit]

Waits for the hub to be shut down.

Waits for the hub to be shut down.

def capacity: Int

The maximum capacity of the hub.

The maximum capacity of the hub.

def contramap[C](f: C => A): CHub[F, C, B]

Transforms messages published to the hub using the specified function.

Transforms messages published to the hub using the specified function.

def contramapM[C](f: C => F[A]): CHub[F, C, B]

Transforms messages published to the hub using the specified effectual function.

Transforms messages published to the hub using the specified effectual function.

def dimap[C, D](f: C => A, g: B => D): CHub[F, C, D]

Transforms messages published to and taken from the hub using the specified functions.

Transforms messages published to and taken from the hub using the specified functions.

def dimapM[C, D](f: C => F[A], g: B => F[D]): CHub[F, C, D]

Transforms messages published to and taken from the hub using the specified effectual functions.

Transforms messages published to and taken from the hub using the specified effectual functions.

def filterInput[A1 <: A](f: A1 => Boolean): CHub[F, A1, B]

Filters messages published to the hub using the specified function.

Filters messages published to the hub using the specified function.

def filterInputM[A1 <: A](f: A1 => F[Boolean]): CHub[F, A1, B]

Filters messages published to the hub using the specified effectual function.

Filters messages published to the hub using the specified effectual function.

def filterOutput(f: B => Boolean): CHub[F, A, B]

Filters messages taken from the hub using the specified function.

Filters messages taken from the hub using the specified function.

def filterOutputM(f: B => F[Boolean]): CHub[F, A, B]

Filters messages taken from the hub using the specified effectual function.

Filters messages taken from the hub using the specified effectual function.

def isShutdown: F[Boolean]

Checks whether the hub is shut down.

Checks whether the hub is shut down.

def map[C](f: B => C): CHub[F, A, C]

Transforms messages taken from the hub using the specified function.

Transforms messages taken from the hub using the specified function.

def mapM[C](f: B => F[C]): CHub[F, A, C]

Transforms messages taken from the hub using the specified effectual function.

Transforms messages taken from the hub using the specified effectual function.

def publish(a: A): F[Boolean]

Publishes a message to the hub, returning whether the message was published to the hub.

Publishes a message to the hub, returning whether the message was published to the hub.

def publishAll(as: Iterable[A]): F[Boolean]

Publishes all of the specified messages to the hub, returning whether they were published to the hub.

Publishes all of the specified messages to the hub, returning whether they were published to the hub.

def shutdown: F[Unit]

Shuts down the hub.

Shuts down the hub.

def size: F[Int]

The current number of messages in the hub.

The current number of messages in the hub.

def subscribe: Resource[F, Dequeue[F, B]]

Subscribes to receive messages from the hub. The resulting subscription can be evaluated multiple times within the scope of the resource to take a message from the hub each time.

Subscribes to receive messages from the hub. The resulting subscription can be evaluated multiple times within the scope of the resource to take a message from the hub each time.

def toQueue: Enqueue[F, A]

Views the hub as a queue that can only be written to.

Views the hub as a queue that can only be written to.