sadanand48 commented on code in PR #3777:
URL: https://github.com/apache/ozone/pull/3777#discussion_r979284786
##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/ListBucketHandler.java:
##########
@@ -51,12 +52,72 @@ protected void execute(OzoneClient client, OzoneAddress
address)
Iterator<? extends OzoneBucket> bucketIterator =
vol.listBuckets(listOptions.getPrefix(), listOptions.getStartItem());
- int counter = printAsJsonArray(bucketIterator, listOptions.getLimit());
+ int counter = 0;
+ while (bucketIterator.hasNext() && counter < listOptions.getLimit()) {
+ OzoneBucket entry = bucketIterator.next();
+ if (entry.getSourceBucket() != null && entry.getSourceVolume() != null) {
+ printObjectAsJson(new LinkBucket(entry));
+ } else {
+ printObjectAsJson(entry);
+ }
+ counter++;
+ }
if (isVerbose()) {
out().printf("Found : %d buckets for volume : %s ", counter, volumeName);
}
}
+ /**
+ * Class used for link buckets.
+ */
+ private static class LinkBucket {
Review Comment:
We can avoid duplicating the class from InfoBucketHandler.
--
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]