[ 
https://issues.apache.org/jira/browse/HDFS-17168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17760213#comment-17760213
 ] 

ASF GitHub Bot commented on HDFS-17168:
---------------------------------------

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


##########
hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/JsonUtilClient.java:
##########
@@ -877,6 +878,40 @@ public static Map<String, String> 
getErasureCodeCodecs(Map<?, ?> json) {
     return map;
   }
 
+  public static Collection<FileStatus> getTrashRoots(Map<?, ?> json) {
+    List<?> objs = (List<?>) json.get("Paths");
+    if (objs != null) {
+      FileStatus[] trashRoots = new FileStatus[objs.size()];
+      for (int i = 0; i < objs.size(); i++) {
+        Map<?, ?> m = (Map<?, ?>) objs.get(i);
+        trashRoots[i] = toFileStatus(m);
+      }
+      return Arrays.asList(trashRoots);
+    }
+    return new ArrayList<FileStatus>(0);
+  }
+
+  public static FileStatus toFileStatus(Map<?, ?> json) {
+    Path path = new Path(getString(json, "path", ""));
+    long length = getLong(json, "length", 0);
+    boolean isdir = getBoolean(json, "isdir", false);

Review Comment:
   Thanks for your suggestion, I'll make the required code changes promptly





> Support getTrashRoots API in WebHDFS
> ------------------------------------
>
>                 Key: HDFS-17168
>                 URL: https://issues.apache.org/jira/browse/HDFS-17168
>             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-08-26-23-13-42-426.png
>
>
> WebHDFS should support getTrashRoots:
> !image-2023-08-26-23-13-42-426.png|width=686,height=204!



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

Reply via email to