Skip to content

Commit 57bb175

Browse files
committed
---
yaml --- r: 3981 b: refs/heads/pubsub-alpha c: e921bbe h: refs/heads/master i: 3979: 7518e70
1 parent 71f893b commit 57bb175

19 files changed

Lines changed: 1193 additions & 1091 deletions

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 36a62ef856d199f8efd09501b5ba65c422c01f23
33
refs/heads/travis: e21ee7b88a5edc3f3d8c71f90c3fc32abf7e8dd6
44
refs/heads/gh-pages: 7406918e071dd2c5677a638ae2a06e7592b6542c
5-
refs/heads/pubsub-alpha: 4c0332ec55ba99c39572ef608ea508e55547ccf7
5+
refs/heads/pubsub-alpha: e921bbe3a44c90039574245f4a4dce5c4fdbd669
66
refs/heads/update-datastore: 47aae517c2cb33f1dccd909adaced73ec9d0f4df
77
refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444
88
refs/tags/v0.0.10: 207ebd2a3472fddee69fe1298eb90429e3306efd

branches/pubsub-alpha/gcloud-java-storage/src/main/java/com/google/cloud/storage/BatchRequest.java

Lines changed: 0 additions & 131 deletions
This file was deleted.

branches/pubsub-alpha/gcloud-java-storage/src/main/java/com/google/cloud/storage/BatchResponse.java

Lines changed: 0 additions & 162 deletions
This file was deleted.

branches/pubsub-alpha/gcloud-java-storage/src/main/java/com/google/cloud/storage/Bucket.java

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,15 @@
2626
import com.google.cloud.storage.Storage.BucketTargetOption;
2727
import com.google.cloud.storage.spi.StorageRpc;
2828
import com.google.common.base.Function;
29+
import com.google.common.collect.ImmutableList;
2930
import com.google.common.collect.Lists;
3031
import com.google.common.collect.Sets;
3132

3233
import java.io.IOException;
3334
import java.io.InputStream;
3435
import java.io.ObjectInputStream;
3536
import java.io.Serializable;
36-
import java.util.ArrayList;
3737
import java.util.Arrays;
38-
import java.util.Collections;
3938
import java.util.List;
4039
import java.util.Objects;
4140
import java.util.Set;
@@ -609,19 +608,28 @@ public Blob get(String blob, BlobGetOption... options) {
609608
* @throws StorageException upon failure
610609
*/
611610
public List<Blob> get(String blobName1, String blobName2, String... blobNames) {
612-
BatchRequest.Builder batch = BatchRequest.builder();
613-
batch.get(name(), blobName1);
614-
batch.get(name(), blobName2);
615-
for (String name : blobNames) {
616-
batch.get(name(), name);
617-
}
618-
List<Blob> blobs = new ArrayList<>(blobNames.length);
619-
BatchResponse response = storage.submit(batch.build());
620-
for (BatchResponse.Result<Blob> result : response.gets()) {
621-
BlobInfo blobInfo = result.get();
622-
blobs.add(blobInfo != null ? new Blob(storage, new BlobInfo.BuilderImpl(blobInfo)) : null);
623-
}
624-
return Collections.unmodifiableList(blobs);
611+
List<BlobId> blobIds = Lists.newArrayListWithCapacity(blobNames.length + 2);
612+
blobIds.add(BlobId.of(name(), blobName1));
613+
blobIds.add(BlobId.of(name(), blobName2));
614+
for (String blobName : blobNames) {
615+
blobIds.add(BlobId.of(name(), blobName));
616+
}
617+
return storage.get(blobIds);
618+
}
619+
620+
/**
621+
* Returns a list of requested blobs in this bucket. Blobs that do not exist are null.
622+
*
623+
* @param blobNames blobs to get
624+
* @return an immutable list of {@code Blob} objects
625+
* @throws StorageException upon failure
626+
*/
627+
public List<Blob> get(Iterable<String> blobNames) {
628+
ImmutableList.Builder<BlobId> builder = ImmutableList.builder();
629+
for (String blobName : blobNames) {
630+
builder.add(BlobId.of(name(), blobName));
631+
}
632+
return storage.get(builder.build());
625633
}
626634

627635
/**

0 commit comments

Comments
 (0)