tanvipenumudy commented on code in PR #7440:
URL: https://github.com/apache/ozone/pull/7440#discussion_r1845904156
##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java:
##########
@@ -549,6 +558,31 @@ private FileStatusAdapter
toFileStatusAdapter(OzoneFileStatus status,
);
}
+ private FileStatusAdapter toFileStatusAdapter(OzoneFileStatusLight status,
+ String owner, URI defaultUri,
Path workingDir) {
+ BasicOmKeyInfo keyInfo = status.getKeyInfo();
+ short replication = (short) keyInfo.getReplicationConfig()
+ .getRequiredNodes();
+ return new FileStatusAdapter(
+ keyInfo.getDataSize(),
+ keyInfo.getReplicatedSize(),
+ new Path(OZONE_URI_DELIMITER + keyInfo.getKeyName())
+ .makeQualified(defaultUri, workingDir),
+ status.isDirectory(),
+ replication,
+ status.getBlockSize(),
+ keyInfo.getModificationTime(),
+ keyInfo.getModificationTime(),
+ status.isDirectory() ? (short) 00777 : (short) 00666,
Review Comment:
I think we may replace the hardcoded permission magic numbers (`00777` and
`00666`) with descriptive constants:
```
private static final short DIRECTORY_PERMISSIONS = (short) 00777;
private static final short FILE_PERMISSIONS = (short) 00666;
return new FileStatusAdapter(
...,
status.isDirectory() ? DIRECTORY_PERMISSIONS : FILE_PERMISSIONS,
...
);
```
##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneFileSystem.java:
##########
@@ -1007,10 +1011,12 @@ private final class OzoneFileStatusIterator<T extends
FileStatus>
* @param p path to file/directory.
* @throws IOException
*/
- private OzoneFileStatusIterator(Path p) throws IOException {
+ private OzoneFileStatusIterator(Path p, Function<FileStatus, T>
transformFunc, boolean lite) throws IOException {
Review Comment:
We may update the Javadoc to incorporate the newly added parameters.
##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java:
##########
@@ -1039,6 +1053,31 @@ private FileStatusAdapter
toFileStatusAdapter(OzoneFileStatus status,
);
}
+ private FileStatusAdapter toFileStatusAdapter(OzoneFileStatusLight status,
+ String owner, URI defaultUri, Path workingDir, String ofsPathPrefix) {
+ BasicOmKeyInfo keyInfo = status.getKeyInfo();
+ short replication = (short) keyInfo.getReplicationConfig()
+ .getRequiredNodes();
+ return new FileStatusAdapter(
+ keyInfo.getDataSize(),
+ keyInfo.getReplicatedSize(),
+ new Path(ofsPathPrefix + OZONE_URI_DELIMITER + keyInfo.getKeyName())
+ .makeQualified(defaultUri, workingDir),
+ status.isDirectory(),
+ replication,
+ status.getBlockSize(),
+ keyInfo.getModificationTime(),
+ keyInfo.getModificationTime(),
+ status.isDirectory() ? (short) 00777 : (short) 00666,
Review Comment:
Same as the above comment for the hardcoded permission values.
##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneFileSystem.java:
##########
@@ -1088,15 +1094,15 @@ public T next() throws IOException {
* @return list of file status.
* @throws IOException
*/
- private List<FileStatus> listFileStatus(Path f, String startPath)
+ private List<FileStatus> listFileStatus(Path f, String startPath, boolean
lite)
Review Comment:
We may update the Javadoc to include the `lite` parameter here as well.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]