Skip to content

Commit 8b25c55

Browse files
authored
Updated ListSnapshotHandler to pass snapshot continuation token and snapshot prefix (#5778)
1 parent 4006640 commit 8b25c55

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/snapshot/ListSnapshotHandler.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import org.apache.hadoop.ozone.client.OzoneClient;
2121
import org.apache.hadoop.ozone.client.OzoneSnapshot;
2222
import org.apache.hadoop.ozone.shell.Handler;
23+
import org.apache.hadoop.ozone.shell.ListOptions;
2324
import org.apache.hadoop.ozone.shell.OzoneAddress;
2425
import org.apache.hadoop.ozone.shell.bucket.BucketUri;
2526
import picocli.CommandLine;
@@ -39,6 +40,9 @@ public class ListSnapshotHandler extends Handler {
3940
@CommandLine.Mixin
4041
private BucketUri snapshotPath;
4142

43+
@CommandLine.Mixin
44+
private ListOptions listOptions;
45+
4246
@Override
4347
protected OzoneAddress getAddress() {
4448
return snapshotPath.getValue();
@@ -51,8 +55,9 @@ protected void execute(OzoneClient client, OzoneAddress address)
5155
String bucketName = snapshotPath.getValue().getBucketName();
5256

5357
Iterator<? extends OzoneSnapshot> snapshotInfos = client.getObjectStore()
54-
.listSnapshot(volumeName, bucketName, null, null);
55-
int counter = printAsJsonArray(snapshotInfos, Integer.MAX_VALUE);
58+
.listSnapshot(volumeName, bucketName, listOptions.getPrefix(),
59+
listOptions.getStartItem());
60+
int counter = printAsJsonArray(snapshotInfos, listOptions.getLimit());
5661
if (isVerbose()) {
5762
err().printf("Found : %d snapshots for o3://%s/%s %n", counter,
5863
volumeName, bucketName);

0 commit comments

Comments
 (0)