From e0c959c212c4a9715ea6ef478f384f3e520a9cb3 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Tue, 20 Oct 2015 14:01:32 -0700 Subject: [PATCH] Pagination for listing LocalBlobStore MPU parts --- .../blobstore/config/LocalBlobStore.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java b/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java index 1f0cca541e..9c65be7e15 100644 --- a/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java +++ b/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java @@ -829,13 +829,19 @@ public final class LocalBlobStore implements BlobStore { @Override public List listMultipartUpload(MultipartUpload mpu) { ImmutableList.Builder parts = ImmutableList.builder(); - PageSet pageSet = list(mpu.containerName(), - new ListContainerOptions().prefix(mpu.blobName() + "-").recursive()); - // TODO: pagination - for (StorageMetadata sm : pageSet) { - int partNumber = Integer.parseInt(sm.getName().substring((mpu.blobName() + "-").length())); - long partSize = -1; // TODO: could call getContentMetadata but did not above - parts.add(MultipartPart.create(partNumber, partSize, sm.getETag())); + ListContainerOptions options = + new ListContainerOptions().prefix(mpu.blobName() + "-").recursive(); + while (true) { + PageSet pageSet = list(mpu.containerName(), options); + for (StorageMetadata sm : pageSet) { + int partNumber = Integer.parseInt(sm.getName().substring((mpu.blobName() + "-").length())); + long partSize = -1; // TODO: could call getContentMetadata but did not above + parts.add(MultipartPart.create(partNumber, partSize, sm.getETag())); + } + if (pageSet.isEmpty() || pageSet.getNextMarker() == null) { + break; + } + options.afterMarker(pageSet.getNextMarker()); } return parts.build(); }