narendly commented on a change in pull request #799: [MSDS] Add REST endpoint
to get mapping of all sharding keys by realm
URL: https://github.com/apache/helix/pull/799#discussion_r382965898
##########
File path:
helix-rest/src/main/java/org/apache/helix/rest/server/resources/metadatastore/MetadataStoreDirectoryAccessor.java
##########
@@ -167,11 +169,15 @@ public Response
deleteMetadataStoreRealm(@PathParam("realm") String realm) {
*/
@GET
@Path("/sharding-keys")
- public Response getShardingKeys(@QueryParam("prefix") String prefix) {
+ public Response getShardingKeys(@QueryParam("prefix") String prefix,
+ @DefaultValue("false") @QueryParam("groupByRealm") boolean groupByRealm)
{
try {
- if (prefix == null) {
+ if (prefix == null && !groupByRealm) {
// For endpoint: "/sharding-keys" to get all sharding keys in a
namespace.
return getAllShardingKeys();
+ } else if (prefix == null) {
+ // For request: "/sharding-keys?groupByRealm=true" to get sharding
keys by realm.
+ return getAllShardingKeysByRealm();
Review comment:
```
if (prefix == null) {
if (groupByRealm) {
return getAllShardingKeysByRealm();
}
return getAllShardingKeys();
}
```
would be a more concise and readable way of expressing this logic. what do
you think?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]