peterxcli commented on code in PR #8124:
URL: https://github.com/apache/ozone/pull/8124#discussion_r2034586176
##########
hadoop-ozone/cli-shell/src/main/java/org/apache/hadoop/ozone/shell/snapshot/ListSnapshotDiffHandler.java:
##########
@@ -37,38 +38,32 @@ public class ListSnapshotDiffHandler extends Handler {
@CommandLine.Mixin
private BucketUri snapshotPath;
- @CommandLine.Option(names = {"-s", "--status"},
+ @CommandLine.Option(names = {"--job-status"},
description = "List jobs based on status.\n" +
"Accepted values are: queued, in_progress, done, failed, rejected",
defaultValue = "in_progress")
private String jobStatus;
- @CommandLine.Option(names = {"-a", "--all"},
- description = "List all jobs regardless of status.",
- defaultValue = "false")
- private boolean listAll;
+ @CommandLine.Mixin
+ private ListOptions listOptions;
@Override
protected OzoneAddress getAddress() {
return snapshotPath.getValue();
}
@Override
- protected void execute(OzoneClient client, OzoneAddress address)
- throws IOException {
-
+ protected void execute(OzoneClient client, OzoneAddress address) throws
IOException {
String volumeName = snapshotPath.getValue().getVolumeName();
String bucketName = snapshotPath.getValue().getBucketName();
- List<OzoneSnapshotDiff> jobList =
- client.getObjectStore().listSnapshotDiffJobs(
- volumeName, bucketName, jobStatus, listAll);
+ Iterator<OzoneSnapshotDiff> iterator = client.getObjectStore()
+ .listSnapshotDiffJobs(volumeName, bucketName, jobStatus,
listOptions.isAll(), listOptions.getStartItem());
+
+ int counter = printAsJsonArray(iterator, listOptions.getLimit());
Review Comment:
The limit is set to `INT.MAX_VAL` if `all` flag is true, how about remove
the `listAll` field and use the `getLimit()` whatever, making the query logic
simpler?
https://github.com/apache/ozone/blob/1a05cf42eddabebeb1fc3d254eb5ab40233e5af1/hadoop-ozone/cli-shell/src/main/java/org/apache/hadoop/ozone/shell/ListOptions.java#L52-L62
--
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]