ashutoshcipher commented on code in PR #4750: URL: https://github.com/apache/hadoop/pull/4750#discussion_r989115132
########## hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/FSOperations.java: ########## @@ -2192,4 +2194,76 @@ public Void execute(FileSystem fs) throws IOException { return null; } } + + /** + * Executor that performs a getFileBlockLocations operation. + */ + + @InterfaceAudience.Private + @SuppressWarnings("rawtypes") + public static class FSFileBlockLocations + implements FileSystemAccess.FileSystemExecutor<Map> { + final private Path path; + final private long offsetValue; + final private long lengthValue; + + /** + * Creates a file-block-locations executor. + * + * @param path the path to retrieve the location + * @param offsetValue offset into the given file + * @param lengthValue length for which to get locations for + */ + public FSFileBlockLocations(String path, long offsetValue, long lengthValue) { + this.path = new Path(path); + this.offsetValue = offsetValue; + this.lengthValue = lengthValue; + } + + @Override + public Map execute(FileSystem fs) throws IOException { + BlockLocation[] locations = fs.getFileBlockLocations(this.path, + this.offsetValue, this.lengthValue); + return JsonUtil.toJsonMap(locations); + } + } + + /** + * Executor that performs a getFileBlockLocations operation for legacy + * clients that supports only GET_BLOCK_LOCATIONS. + */ + + @InterfaceAudience.Private + @SuppressWarnings("rawtypes") + public static class FSFileBlockLocationsLegacy + implements FileSystemAccess.FileSystemExecutor<Map> { Review Comment: making this single line will cross 100 -- 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: common-issues-unsubscr...@hadoop.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org