zhangmeng916 commented on a change in pull request #1416:
URL: https://github.com/apache/helix/pull/1416#discussion_r496128430



##########
File path: 
helix-rest/src/main/java/org/apache/helix/rest/server/resources/helix/ClusterAccessor.java
##########
@@ -442,6 +442,29 @@ public Response getClusterTopology(@PathParam("clusterId") 
String clusterId) thr
     return OK(objectMapper.writeValueAsString(clusterTopology));
   }
 
+  @ResponseMetered(name = HttpConstants.READ_REQUEST)
+  @Timed(name = HttpConstants.READ_REQUEST)
+  @GET
+  @Path("{clusterId}/topologymap")
+  public Response getClusterTopologyMap(@PathParam("clusterId") String 
clusterId) {
+    if (!doesClusterExist(clusterId)) {
+      return notFound(String.format("Cluster %s does not exist", clusterId));
+    }
+    HelixAdmin admin = getHelixAdmin();
+    Map<String, List<String>> topologyMap = 
admin.getClusterTopology(clusterId).getTopologyMap();
+    return JSONRepresentation(topologyMap);
+  }
+
+  @ResponseMetered(name = HttpConstants.READ_REQUEST)
+  @Timed(name = HttpConstants.READ_REQUEST)
+  @GET
+  @Path("{clusterId}/faultzonemap")

Review comment:
       There is already a legacy `topology` REST API in this class, so we have 
to use a different one. Any other idea than `topologymap`?
   Regarding the suggestion of fault zone query, what you said is actually my 
previous implementation. However, we then decided to only expose the most 
common use case, i.e., return the topology under fault zone as an API to our 
users. So this fault zone API is not a generic one that accepts any level of 
domain. Instead, it's a fixed one only for "fault zone type" defined in 
topology.




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to