pkuwm commented on a change in pull request #761: Add REST read endpoints to 
helix-rest for metadata store directory
URL: https://github.com/apache/helix/pull/761#discussion_r379284824
 
 

 ##########
 File path: 
helix-rest/src/main/java/org/apache/helix/rest/server/resources/metadatastore/MetadataStoreDirectoryAccessor.java
 ##########
 @@ -111,41 +132,56 @@ public Response 
deleteMetadataStoreRealm(@PathParam("realm") String realm) {
   }
 
   /**
-   * Gets sharding keys mapped at path "HTTP GET /sharding-keys" which returns 
all sharding keys in
-   * a namespace, or path "HTTP GET /sharding-keys?realm={realmName}" which 
returns sharding keys in
-   * a realm.
+   * Gets all sharding keys mapped at paths:
+   * - "HTTP GET /sharding-keys" which returns all sharding keys in a 
namespace.
+   * - "HTTP GET /sharding-keys?realm={realm}" which returns sharding keys in 
the realm.
+   * - "HTTP GET /sharding-keys?prefix={prefix}" which returns sharding keys 
that have the prefix.
+   * -- JSON response example for this path:
+   * {
+   *   "prefix": "/sharding/key",
+   *   "shardingKeys": [{
+   *           "realm": "testRealm2",
+   *           "shardingKey": "/sharding/key/1/f"
+   *    }, {
+   *           "realm": "testRealm2",
+   *           "shardingKey": "/sharding/key/1/e"
+   *  }, {
+   *           "realm": "testRealm1",
+   *           "shardingKey": "/sharding/key/1/b"
+   *  }, {
+   *           "realm": "testRealm1",
+   *           "shardingKey": "/sharding/key/1/a"
+   *  }]
+   * }
+   *
+   * - "HTTP GET /sharding-keys?realm={realm}&prefix={prefix}" which returns 
sharding keys in the
+   * realm and that have the prefix.
    *
-   * @param realm Query param in endpoint path
-   * @return Json representation of a map: shardingKeys -> collection of 
sharding keys.
+   * @param realm Query param in endpoint path: metadata store realm.
+   * @param prefix Query param in endpoint path: prefix substring of sharding 
key.
+   * @return Json representation for the sharding keys.
    */
   @GET
   @Path("/sharding-keys")
-  public Response getShardingKeys(@QueryParam("realm") String realm) {
-    Map<String, Object> responseMap;
-    Collection<String> shardingKeys;
+  public Response getShardingKeys(@QueryParam("realm") String realm,
 
 Review comment:
   A new endpoint which is equivalent to GET /sharding-keys?realm={realm} is 
added: GET /metadata-store-realms/{realm}/sharding-keys
   
   In my opinion, these 2 filters are valid for this resource. If remove one 
query param, this method would only have 1 query param `prefix` and 1 if-else: 
all sharding keys or sharding keys with prefix. 
   But again, I would like to offer this query param option as they are valid, 
and it is also implemented now.

----------------------------------------------------------------
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]

Reply via email to