Repository: jclouds
Updated Branches:
  refs/heads/master 22cfbb86f -> f6d95d0fd


JCLOUDS-1390: Use FULL projection for list blobs

This avoids a per-object call during detailed listings.


Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/f6d95d0f
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/f6d95d0f
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/f6d95d0f

Branch: refs/heads/master
Commit: f6d95d0fda22ff00bf9fa6bfab9e19e703a08f1e
Parents: 22cfbb8
Author: Alin Dreghiciu <adreghi...@gmail.com>
Authored: Wed Mar 7 20:21:01 2018 +0200
Committer: Andrew Gaul <g...@apache.org>
Committed: Wed Mar 7 21:47:44 2018 -0800

----------------------------------------------------------------------
 .../blobstore/GoogleCloudStorageBlobStore.java               | 8 +-------
 .../BlobStoreListContainerOptionsToListObjectOptions.java    | 4 ++++
 2 files changed, 5 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/f6d95d0f/providers/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/GoogleCloudStorageBlobStore.java
----------------------------------------------------------------------
diff --git 
a/providers/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/GoogleCloudStorageBlobStore.java
 
b/providers/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/GoogleCloudStorageBlobStore.java
index 989a316..63834e4 100644
--- 
a/providers/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/GoogleCloudStorageBlobStore.java
+++ 
b/providers/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/GoogleCloudStorageBlobStore.java
@@ -45,7 +45,6 @@ import org.jclouds.blobstore.options.CreateContainerOptions;
 import org.jclouds.blobstore.options.GetOptions;
 import org.jclouds.blobstore.options.ListContainerOptions;
 import org.jclouds.blobstore.options.PutOptions;
-import org.jclouds.blobstore.strategy.internal.FetchBlobMetadata;
 import org.jclouds.blobstore.util.BlobUtils;
 import org.jclouds.collect.Memoized;
 import org.jclouds.domain.Location;
@@ -79,7 +78,6 @@ import com.google.common.base.Supplier;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Iterables;
 import com.google.common.hash.HashCode;
-import com.google.inject.Provider;
 
 public final class GoogleCloudStorageBlobStore extends BaseBlobStore {
 
@@ -87,7 +85,6 @@ public final class GoogleCloudStorageBlobStore extends 
BaseBlobStore {
    private final BucketToStorageMetadata bucketToStorageMetadata;
    private final ObjectToBlobMetadata objectToBlobMetadata;
    private final ObjectListToStorageMetadata objectListToStorageMetadata;
-   private final Provider<FetchBlobMetadata> fetchBlobMetadataProvider;
    private final BlobMetadataToObjectTemplate blobMetadataToObjectTemplate;
    private final BlobStoreListContainerOptionsToListObjectOptions 
listContainerOptionsToListObjectOptions;
    private final Supplier<String> projectId;
@@ -97,7 +94,6 @@ public final class GoogleCloudStorageBlobStore extends 
BaseBlobStore {
             @Memoized Supplier<Set<? extends Location>> locations, 
PayloadSlicer slicer, GoogleCloudStorageApi api,
             BucketToStorageMetadata bucketToStorageMetadata, 
ObjectToBlobMetadata objectToBlobMetadata,
             ObjectListToStorageMetadata objectListToStorageMetadata,
-            Provider<FetchBlobMetadata> fetchBlobMetadataProvider,
             BlobMetadataToObjectTemplate blobMetadataToObjectTemplate,
             BlobStoreListContainerOptionsToListObjectOptions 
listContainerOptionsToListObjectOptions,
             @CurrentProject Supplier<String> projectId,
@@ -107,7 +103,6 @@ public final class GoogleCloudStorageBlobStore extends 
BaseBlobStore {
       this.bucketToStorageMetadata = bucketToStorageMetadata;
       this.objectToBlobMetadata = objectToBlobMetadata;
       this.objectListToStorageMetadata = objectListToStorageMetadata;
-      this.fetchBlobMetadataProvider = checkNotNull(fetchBlobMetadataProvider, 
"fetchBlobMetadataProvider");
       this.blobMetadataToObjectTemplate = blobMetadataToObjectTemplate;
       this.listContainerOptionsToListObjectOptions = 
listContainerOptionsToListObjectOptions;
       this.projectId = projectId;
@@ -192,8 +187,7 @@ public final class GoogleCloudStorageBlobStore extends 
BaseBlobStore {
    public PageSet<? extends StorageMetadata> list(String container, 
ListContainerOptions options) {
       ListObjectOptions listOptions = 
listContainerOptionsToListObjectOptions.apply(options);
       ListPageWithPrefixes<GoogleCloudStorageObject> gcsList = 
api.getObjectApi().listObjects(container, listOptions);
-      PageSet<? extends StorageMetadata> list = 
objectListToStorageMetadata.apply(gcsList);
-      return options.isDetailed() ? 
fetchBlobMetadataProvider.get().setContainerName(container).apply(list) : list;
+      return objectListToStorageMetadata.apply(gcsList);
    }
 
    /**

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f6d95d0f/providers/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/functions/BlobStoreListContainerOptionsToListObjectOptions.java
----------------------------------------------------------------------
diff --git 
a/providers/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/functions/BlobStoreListContainerOptionsToListObjectOptions.java
 
b/providers/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/functions/BlobStoreListContainerOptionsToListObjectOptions.java
index 15b5f4f..f59dfec 100644
--- 
a/providers/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/functions/BlobStoreListContainerOptionsToListObjectOptions.java
+++ 
b/providers/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/functions/BlobStoreListContainerOptionsToListObjectOptions.java
@@ -19,6 +19,7 @@ package org.jclouds.googlecloudstorage.blobstore.functions;
 import static com.google.common.base.Preconditions.checkNotNull;
 
 import org.jclouds.blobstore.options.ListContainerOptions;
+import 
org.jclouds.googlecloudstorage.domain.DomainResourceReferences.Projection;
 import org.jclouds.googlecloudstorage.options.ListObjectOptions;
 
 import com.google.common.base.Function;
@@ -53,6 +54,9 @@ public class BlobStoreListContainerOptionsToListObjectOptions 
implements
       if (from.getMaxResults() != null) {
          httpOptions = httpOptions.maxResults(from.getMaxResults());
       }
+      if (from.isDetailed()) {
+         httpOptions = httpOptions.projection(Projection.FULL);
+      }
       return httpOptions;
    }
 }

Reply via email to