[ https://issues.apache.org/jira/browse/HDFS-17029?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17727869#comment-17727869 ]
ASF GitHub Bot commented on HDFS-17029: --------------------------------------- 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! > Support getECPolices API in WebHDFS > ----------------------------------- > > Key: HDFS-17029 > URL: https://issues.apache.org/jira/browse/HDFS-17029 > Project: Hadoop HDFS > Issue Type: Improvement > Components: webhdfs > Affects Versions: 3.4.0 > Reporter: Hualong Zhang > Assignee: Hualong Zhang > Priority: Major > Labels: pull-request-available > Attachments: image-2023-05-29-23-55-09-224.png > > > WebHDFS should support getEcPolicies: > !image-2023-05-29-23-55-09-224.png|width=817,height=234! -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org