Sharding

com.devsisters.shardcake.Sharding
See theSharding companion class
object Sharding

Attributes

Companion
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Sharding.type

Members list

Type members

Classlikes

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Value members

Concrete methods

def broadcaster[Msg](topicType: TopicType[Msg], sendTimeout: MessengerTimeout): URIO[Sharding, Broadcaster[Msg]]

Get an object that allows broadcasting messages to a given topic type. You can provide a custom send timeout to override the one globally defined.

Get an object that allows broadcasting messages to a given topic type. You can provide a custom send timeout to override the one globally defined.

Attributes

def getPods: RIO[Sharding, Set[PodAddress]]

Get the list of pods currently registered to the Shard Manager

Get the list of pods currently registered to the Shard Manager

Attributes

def messenger[Msg](entityType: EntityType[Msg], sendTimeout: MessengerTimeout): URIO[Sharding, Messenger[Msg]]

Get an object that allows sending messages to a given entity type. You can provide a custom send timeout to override the one globally defined.

Get an object that allows sending messages to a given entity type. You can provide a custom send timeout to override the one globally defined.

Attributes

def register: RIO[Sharding, Unit]

Notify the shard manager that shards can now be assigned to this pod.

Notify the shard manager that shards can now be assigned to this pod.

Attributes

def registerEntity[R, Req : Tag](entityType: EntityType[Req], behavior: (String, Queue[Req]) => RIO[R, Nothing], terminateMessage: (Promise[Nothing, Unit]) => Option[Req], entityMaxIdleTime: Option[Duration]): URIO[Sharding & Scope & R, Unit]

Register a new entity type, allowing pods to send messages to entities of this type. It takes a behavior which is a function from an entity ID and a queue of messages to a ZIO computation that runs forever and consumes those messages. You can use ZIO.interrupt from the behavior to stop it (it will be restarted the next time the entity receives a message). If provided, the optional terminateMessage will be sent to the entity before it is stopped, allowing for cleanup logic.

Register a new entity type, allowing pods to send messages to entities of this type. It takes a behavior which is a function from an entity ID and a queue of messages to a ZIO computation that runs forever and consumes those messages. You can use ZIO.interrupt from the behavior to stop it (it will be restarted the next time the entity receives a message). If provided, the optional terminateMessage will be sent to the entity before it is stopped, allowing for cleanup logic.

Attributes

def registerScoped: RIO[Sharding & Scope, Unit]

Same as register, but will automatically call unregister when the Scope is terminated.

Same as register, but will automatically call unregister when the Scope is terminated.

Attributes

def registerSingleton[R](name: String, run: URIO[R, Nothing]): URIO[Sharding & R, Unit]

Start a computation that is guaranteed to run only on a single pod. Each pod should call registerSingleton but only a single pod will actually run it at any given time.

Start a computation that is guaranteed to run only on a single pod. Each pod should call registerSingleton but only a single pod will actually run it at any given time.

Attributes

def registerTopic[R, Req : Tag](topicType: TopicType[Req], behavior: (String, Queue[Req]) => RIO[R, Nothing], terminateMessage: (Promise[Nothing, Unit]) => Option[Req]): URIO[Sharding & Scope & R, Unit]

Register a new topic type, allowing pods to broadcast messages to subscribers. It takes a behavior which is a function from a topic and a queue of messages to a ZIO computation that runs forever and consumes those messages. You can use ZIO.interrupt from the behavior to stop it (it will be restarted the next time the topic receives a message). If provided, the optional terminateMessage will be sent to the topic before it is stopped, allowing for cleanup logic.

Register a new topic type, allowing pods to broadcast messages to subscribers. It takes a behavior which is a function from a topic and a queue of messages to a ZIO computation that runs forever and consumes those messages. You can use ZIO.interrupt from the behavior to stop it (it will be restarted the next time the topic receives a message). If provided, the optional terminateMessage will be sent to the topic before it is stopped, allowing for cleanup logic.

Attributes

def terminateLocalEntity(entityType: EntityType[_], entityId: String): URIO[Sharding, Unit]

Terminate a given entity. If a termination message was provided, that message will be sent to the entity and no new message will be enqueued after that. If no termination message was provided, the entity will be stopped immediately. This method can only be used if the entity is hosted on the current pod (otherwise it will do nothing). Typically, you would use this method from inside the entity behavior to stop itself.

Terminate a given entity. If a termination message was provided, that message will be sent to the entity and no new message will be enqueued after that. If no termination message was provided, the entity will be stopped immediately. This method can only be used if the entity is hosted on the current pod (otherwise it will do nothing). Typically, you would use this method from inside the entity behavior to stop itself.

Attributes

def unregister: URIO[Sharding, Unit]

Notify the shard manager that shards must be unassigned from this pod.

Notify the shard manager that shards must be unassigned from this pod.

Attributes

Concrete fields

val live: ZLayer[Pods & ShardManagerClient & Storage & Serialization & Config, Throwable, Sharding]

A layer that sets up sharding communication between pods.

A layer that sets up sharding communication between pods.

Attributes