Skip to content

Commit

Permalink
Updated ListSnapshotHandler to pass snapshot continuation token and s…
Browse files Browse the repository at this point in the history
…napshot prefix (#5778)
  • Loading branch information
hemantk-12 authored Dec 14, 2023
1 parent 4006640 commit 8b25c55
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.apache.hadoop.ozone.client.OzoneClient;
import org.apache.hadoop.ozone.client.OzoneSnapshot;
import org.apache.hadoop.ozone.shell.Handler;
import org.apache.hadoop.ozone.shell.ListOptions;
import org.apache.hadoop.ozone.shell.OzoneAddress;
import org.apache.hadoop.ozone.shell.bucket.BucketUri;
import picocli.CommandLine;
Expand All @@ -39,6 +40,9 @@ public class ListSnapshotHandler extends Handler {
@CommandLine.Mixin
private BucketUri snapshotPath;

@CommandLine.Mixin
private ListOptions listOptions;

@Override
protected OzoneAddress getAddress() {
return snapshotPath.getValue();
Expand All @@ -51,8 +55,9 @@ protected void execute(OzoneClient client, OzoneAddress address)
String bucketName = snapshotPath.getValue().getBucketName();

Iterator<? extends OzoneSnapshot> snapshotInfos = client.getObjectStore()
.listSnapshot(volumeName, bucketName, null, null);
int counter = printAsJsonArray(snapshotInfos, Integer.MAX_VALUE);
.listSnapshot(volumeName, bucketName, listOptions.getPrefix(),
listOptions.getStartItem());
int counter = printAsJsonArray(snapshotInfos, listOptions.getLimit());
if (isVerbose()) {
err().printf("Found : %d snapshots for o3://%s/%s %n", counter,
volumeName, bucketName);
Expand Down

0 comments on commit 8b25c55

Please sign in to comment.