xiaoyuyao commented on a change in pull request #547: HDDS-2928. Implement 
ofs://: listStatus
URL: https://github.com/apache/hadoop-ozone/pull/547#discussion_r383551878
 
 

 ##########
 File path: 
hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java
 ##########
 @@ -664,17 +732,73 @@ private FileStatusAdapter 
toFileStatusAdapter(OzoneFileStatus status) {
     );
   }
 
+  /**
+   * Generate a FileStatusAdapter for a volume.
+   * @param ozoneVolume OzoneVolume object
+   * @param uri Full URI to OFS root.
+   * @return FileStatusAdapter for a volume.
+   */
+  private static FileStatusAdapter getFileStatusAdapterForVolume(
+      OzoneVolume ozoneVolume, URI uri) {
+    String pathStr = uri.toString() +
+        OZONE_URI_DELIMITER + ozoneVolume.getName();
+    LOG.debug("getFileStatusAdapterForVolume(pathStr=" + pathStr);
+    Path path = new Path(pathStr);
+    return new FileStatusAdapter(
+        0L,
+        path,
+        true,
+        (short)0,
+        0L,
+        ozoneVolume.getCreationTime().getEpochSecond() * 1000,
+        0L,
+        (short)00755,  // Default directory permission, derive from ACLs later?
+        ozoneVolume.getOwner(),
+        ozoneVolume.getAdmin(),  // TODO: Get group of whom?
+        path
+    );
+  }
+
+  /**
+   * Generate a FileStatusAdapter for a bucket.
+   * @param ozoneBucket OzoneBucket object.
+   * @param uri Full URI to OFS root.
+   * @return FileStatusAdapter for a bucket.
+   */
+  private static FileStatusAdapter getFileStatusAdapterForBucket(
+      OzoneBucket ozoneBucket, URI uri, String username) {
+    String pathStr = uri.toString() +
+        OZONE_URI_DELIMITER + ozoneBucket.getVolumeName() +
+        OZONE_URI_DELIMITER + ozoneBucket.getName();
+    LOG.debug("getFileStatusAdapterForBucket(pathStr=" + pathStr);
+    Path path = new Path(pathStr);
+    return new FileStatusAdapter(
+        0L,
+        path,
+        true,
+        (short)0,
+        0L,
+        ozoneBucket.getCreationTime().getEpochSecond() * 1000,
+        0L,
+        (short)00755,  // Default directory permission, derive from ACLs later?
+        username,  // TODO: owner and group.
+        username,
+        path
+    );
+  }
+
   /**
    * Generate a FileStatusAdapter for OFS root.
+   * @param uri Full URI to OFS root.
    * @return FileStatusAdapter for root.
    */
-  private static FileStatusAdapter rootFileStatusAdapter() {
+  private static FileStatusAdapter getFileStatusAdapterForRoot(URI uri) {
     // Note that most fields are mimicked from HDFS FileStatus for root,
     //  except modification time, permission, owner and group.
-    // TODO: Revisit the return value.
+    Path path = new Path(uri.toString() + OZONE_URI_DELIMITER);
     return new FileStatusAdapter(
 
 Review comment:
   Agree. 

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: ozone-issues-h...@hadoop.apache.org

Reply via email to