Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose current pod assignments #145

Merged
merged 3 commits into from
Oct 17, 2024

Conversation

yoohaemin
Copy link
Contributor

@yoohaemin yoohaemin commented Oct 16, 2024

As discussed here: https://discord.com/channels/629491597070827530/1017210544295522325/1282152828911091793

Exposing the list of assignments helps with some kinds of optimizations, like when creating entities: the business logic can use the information to pick an entity id which has a local shard id. This saves round trip when simulateRemotePods=false.

This information is already visible with the storage api, although inefficient.

I've also made some frequently used ZIO values into val.

@@ -127,7 +127,13 @@ class Sharding private (
pod = shards.get(shardId)
} yield pod.contains(address)

def getPods: UIO[Set[PodAddress]] =
val getAssignments: UIO[Map[ShardId, PodAddress]] =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add them to the companion object like getPods?

@ghostdogpr
Copy link
Collaborator

to(Chunk) doesn't seem to be supported by Scala 2.12

@ghostdogpr ghostdogpr merged commit bdca297 into devsisters:series/2.x Oct 17, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants