Skip to content

Commit 749bf65

Browse files
author
Ajay Kannan
committed
---
yaml --- r: 7153 b: refs/heads/tswast-patch-1 c: 76e3b3e h: refs/heads/master i: 7151: edd37f5
1 parent b3b28ae commit 749bf65

7 files changed

Lines changed: 191 additions & 331 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ refs/tags/v0.18.0: 9d193c4c4b9d1c6f21515dd8e50836b9194ec9bb
5757
refs/tags/v0.19.0: e67b56e4d8dad5f9a7b38c9b2107c23c828f2ed5
5858
refs/tags/v0.20.0: 839f7fb7156535146aa1cb2c5aadd8d375d854e8
5959
refs/tags/v0.20.1: 370471f437f1f4f68a11e068df5cd6bf39edb1fa
60-
refs/heads/tswast-patch-1: c95e5e7dbecaeb613e77385f62258f9c43b32af2
60+
refs/heads/tswast-patch-1: 76e3b3ef5ead06e8741d887ca8c337451470692a
6161
refs/heads/pubsub-streaming-pull: 19262b752ee874eb2ca3b950eb2aef44d5a5267b

branches/tswast-patch-1/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Datastore.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,28 +114,27 @@ interface TransactionCallable<T> {
114114
Entity get(Key key, ReadOption... options);
115115

116116
/**
117-
* Returns an {@link Entity} for each given {@link Key} that exists in the Datastore.
118-
* The order of the result is unspecified.
119-
* Results are loaded lazily, so it is possible to get a {@code DatastoreException}
120-
* from the returned {@code Iterator}'s {@link Iterator#hasNext hasNext} or
121-
* {@link Iterator#next next} methods. {@link ReadOption}s can be specified if desired.
117+
* Returns an {@link Entity} for each given {@link Key} that exists in the Datastore. The order of
118+
* the result is unspecified. Results are loaded lazily, so it is possible to get a
119+
* {@code DatastoreException} from the returned {@code Iterator}'s
120+
* {@link Iterator#hasNext hasNext} or {@link Iterator#next next} methods. {@link ReadOption}s can
121+
* be specified if desired.
122122
*
123123
* @throws DatastoreException upon failure
124124
* @see #get(Key)
125125
*/
126126
Iterator<Entity> get(Iterable<Key> keys, ReadOption... options);
127127

128128
/**
129-
* Returns a list with a value for each given key (ordered by input).
130-
* {@code null} values are returned for nonexistent keys.
131-
* When possible prefer using {@link #get(Key...)} to avoid eagerly loading the results.
132-
* {@link ReadOption}s can be specified if desired.
129+
* Returns a list with a value for each given key (ordered by input). {@code null} values are
130+
* returned for nonexistent keys. When possible prefer using {@link #get(Key...)} to avoid eagerly
131+
* loading the results. {@link ReadOption}s can be specified if desired.
133132
*/
134133
List<Entity> fetch(Iterable<Key> keys, ReadOption... options);
135134

136135
/**
137-
* Submits a {@link Query} and returns its result.
138-
* {@link ReadOption}s can be specified if desired.
136+
* Submits a {@link Query} and returns its result. {@link ReadOption}s can be specified if
137+
* desired.
139138
*
140139
* @throws DatastoreException upon failure
141140
*/

branches/tswast-patch-1/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreHelper.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,19 @@ static KeyFactory newKeyFactory(DatastoreOptions options) {
5656
}
5757

5858
/**
59-
* Returns a list with a value for each given key (ordered by input).
60-
* {@code null} values are returned for nonexistent keys.
59+
* Returns a list with a value for each given key (ordered by input). {@code null} values are
60+
* returned for nonexistent keys.
6161
*/
6262
static List<Entity> fetch(Transaction reader, Key... keys) {
63-
Iterator<Entity> entities = reader.get(keys);
64-
return compileEntities(keys, entities);
63+
return compileEntities(keys, reader.get(keys));
6564
}
6665

6766
/**
68-
* Returns a list with a value for each given key (ordered by input).
69-
* {@code null} values are returned for nonexistent keys.
67+
* Returns a list with a value for each given key (ordered by input). {@code null} values are
68+
* returned for nonexistent keys.
7069
*/
7170
static List<Entity> fetch(Datastore reader, Key[] keys, ReadOption... options) {
72-
Iterator<Entity> entities;
73-
entities = reader.get(Arrays.asList(keys), options);
74-
return compileEntities(keys, entities);
71+
return compileEntities(keys, reader.get(Arrays.asList(keys), options));
7572
}
7673

7774
private static List<Entity> compileEntities(Key[] keys, Iterator<Entity> entities) {

branches/tswast-patch-1/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreImpl.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -210,16 +210,11 @@ public Iterator<Entity> get(Iterable<Key> keys, ReadOption... options) {
210210

211211
private static com.google.datastore.v1beta3.ReadOptions toReadOptionsPb(ReadOption... options) {
212212
com.google.datastore.v1beta3.ReadOptions readOptionsPb = null;
213-
if (options != null) {
214-
Map<Class<? extends ReadOption>, ReadOption> optionsMap = ReadOption.asImmutableMap(options);
215-
EventualConsistency eventualConsistency =
216-
(EventualConsistency) optionsMap.get(EventualConsistency.class);
217-
if (eventualConsistency != null) {
218-
readOptionsPb =
219-
com.google.datastore.v1beta3.ReadOptions.newBuilder()
220-
.setReadConsistency(ReadConsistency.EVENTUAL)
221-
.build();
222-
}
213+
if (options != null
214+
&& ReadOption.asImmutableMap(options).containsKey(EventualConsistency.class)) {
215+
readOptionsPb = com.google.datastore.v1beta3.ReadOptions.newBuilder()
216+
.setReadConsistency(ReadConsistency.EVENTUAL)
217+
.build();
223218
}
224219
return readOptionsPb;
225220
}

branches/tswast-patch-1/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreReader.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,20 @@ public interface DatastoreReader {
3232
Entity get(Key key);
3333

3434
/**
35-
* Returns an {@link Entity} for each given {@link Key} that exists in the Datastore.
36-
* The order of the result is unspecified.
37-
* Results are loaded lazily, so it is possible to get a {@code DatastoreException}
38-
* from the returned {@code Iterator}'s {@link Iterator#hasNext hasNext} or
39-
* {@link Iterator#next next} methods.
35+
* Returns an {@link Entity} for each given {@link Key} that exists in the Datastore. The order of
36+
* the result is unspecified. Results are loaded lazily, so it is possible to get a
37+
* {@code DatastoreException} from the returned {@code Iterator}'s
38+
* {@link Iterator#hasNext hasNext} or {@link Iterator#next next} methods.
4039
*
4140
* @throws DatastoreException upon failure
4241
* @see #get(Key)
4342
*/
4443
Iterator<Entity> get(Key... key);
4544

4645
/**
47-
* Returns a list with a value for each given key (ordered by input).
48-
* {@code null} values are returned for nonexistent keys.
49-
* When possible prefer using {@link #get(Key...)} to avoid eagerly loading the results.
46+
* Returns a list with a value for each given key (ordered by input). {@code null} values are
47+
* returned for nonexistent keys. When possible prefer using {@link #get(Key...)} to avoid eagerly
48+
* loading the results.
5049
*/
5150
List<Entity> fetch(Key... keys);
5251

branches/tswast-patch-1/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/ReadOption.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public boolean isEventual() {
4747
}
4848
}
4949

50-
ReadOption() {}
50+
private ReadOption() {}
5151

5252
/**
5353
* Returns a {@code ReadOption} that specifies eventual consistency.

0 commit comments

Comments
 (0)