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 API for calculating shard ID from token #232

Open
avelanarius opened this issue Jul 14, 2023 · 0 comments
Open

Expose API for calculating shard ID from token #232

avelanarius opened this issue Jul 14, 2023 · 0 comments
Assignees

Comments

@avelanarius
Copy link
Member

As reported by a user: https://forum.scylladb.com/t/how-to-get-node-sharding-information-using-scylla-java-driver/696, the driver should offer an easy way to calculate the shard ID from a token. This can be useful for applications that want to do some more complex access patterns in a performant way.

In Java Driver 3.x, most of the API is public (except Token subclasses), so it's relatively easy to calculate it. In Java Driver 4.x, ShardingInfo class is not public, so it's hard to calculate it for a user.

Bouncheck added a commit to Bouncheck/java-driver that referenced this issue Jul 27, 2023
Adds ShardingInfo field to DefaultNode and getShardingInfo() to Node
interface. Adds NodeShardingInfo interface as public API.

With this change, having a token and having determined the Node it belongs to,
users can further use NodeShardingInfo to determine the shard it belongs to.

Fixes scylladb#232.
Bouncheck added a commit to Bouncheck/java-driver that referenced this issue Jul 28, 2023
Adds ShardingInfo field to DefaultNode and getShardingInfo() to Node
interface. Adds NodeShardingInfo interface as public API.

With this change, having a token and having determined the Node it belongs to,
users can further use NodeShardingInfo to determine the shard it belongs to.

Fixes scylladb#232.
Bouncheck added a commit to Bouncheck/java-driver that referenced this issue Aug 1, 2023
Adds ShardingInfo field to DefaultNode and getShardingInfo() to Node
interface. Adds NodeShardingInfo interface as public API.

With this change, having a token and having determined the Node it belongs to,
users can further use NodeShardingInfo to determine the shard it belongs to.

Fixes scylladb#232.
Bouncheck added a commit to Bouncheck/java-driver that referenced this issue Aug 1, 2023
Adds ShardingInfo field to DefaultNode and getShardingInfo() to Node
interface. Adds NodeShardingInfo interface as public API.

With this change, having a token and having determined the Node it belongs to,
users can further use NodeShardingInfo to determine the shard it belongs to.

Fixes scylladb#232.
@avelanarius avelanarius self-assigned this Jan 15, 2024
avelanarius pushed a commit that referenced this issue Jan 15, 2024
Adds ShardingInfo field to DefaultNode and getShardingInfo() to Node
interface. Adds NodeShardingInfo interface as public API.

With this change, having a token and having determined the Node it belongs to,
users can further use NodeShardingInfo to determine the shard it belongs to.

Fixes #232.
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

No branches or pull requests

1 participant