You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "zhtttylz (via GitHub)" <gi...@apache.org> on 2023/05/31 09:10:53 UTC

[GitHub] [hadoop] zhtttylz commented on a diff in pull request #5698: HDFS-17029. Support getECPolices API in WebHDFS

zhtttylz commented on code in PR #5698:
URL: https://github.com/apache/hadoop/pull/5698#discussion_r1211341558


##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/JsonUtil.java:
##########
@@ -741,4 +741,27 @@ public static Map<String, Object> toJsonMap(FsStatus status) {
     m.put("remaining", status.getRemaining());
     return m;
   }
+
+  public static Map<String, Object> toJsonMap(ErasureCodingPolicyInfo ecPolicyInfo) {
+    if (ecPolicyInfo == null) {
+      return null;
+    }
+    Map<String, Object> m = new HashMap<>();
+    m.put("policy", ecPolicyInfo.getPolicy());
+    m.put("state", ecPolicyInfo.getState());
+    return m;
+  }
+
+  public static String toJsonString(ErasureCodingPolicyInfo[] ecPolicyInfos) {
+    final Map<String, Object> erasureCodingPolicies = new TreeMap<>();

Review Comment:
   Thank you for your valuable suggestion. Since sorting of keys is not required, it's unnecessary to use `TreeMap`.  I sincerely appreciate it and will promptly implement the required adjustments to the code!



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

To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org