xiaoyuyao commented on a change in pull request #547: HDDS-2928. Implement
ofs://: listStatus
URL: https://github.com/apache/hadoop-ozone/pull/547#discussion_r382227426
##########
File path:
hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java
##########
@@ -486,6 +491,57 @@ public void makeQualified(FileStatus status, URI uri,
Path path,
return new IteratorAdapter(bucket.listKeys(key));
}
+ /**
+ * Helper for OFS listStatus on root.
+ */
+ private List<FileStatusAdapter> listStatusRoot(
+ boolean recursive, String startPath, long numEntries,
+ URI uri, Path workingDir, String username) throws IOException {
+ OFSPath ofsStartPath = new OFSPath(startPath);
+ // list volumes for user
+ Iterator<? extends OzoneVolume> iter = objectStore.listVolumesByUser(
+ username, null, ofsStartPath.getVolumeName());
+ List<FileStatusAdapter> res = new ArrayList<>();
+ // TODO: Test continuation
+ while (iter.hasNext() && res.size() <= numEntries) {
+ OzoneVolume volume = iter.next();
+ res.add(getFileStatusAdapterForVolume(volume, uri));
+ if (recursive) {
+ String next = volume.getName();
+ // TODO: Check startPath
+ res.addAll(listStatus(next, recursive, startPath,
+ numEntries - res.size(), uri, workingDir, username));
+ }
+ }
+ return res;
+ }
+
+ /**
+ * Helper for OFS listStatus on a volume.
+ */
+ private List<FileStatusAdapter> listStatusVolume(String volumeStr,
+ boolean recursive, String startPath, long numEntries,
+ URI uri, Path workingDir, String username) throws IOException {
+ OFSPath ofsStartPath = new OFSPath(startPath);
Review comment:
should we use startBucket as parameter to avoid creating OFSPath
unnecessarily?
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]