Skip to content

Commit 8f0d2ab

Browse files
ludochgae-java-bot
authored andcommitted
Proto2 migration
PiperOrigin-RevId: 846864416 Change-Id: I82597bb129303e4cdece7ee7c25684c7da8fcc99
1 parent 00a0104 commit 8f0d2ab

File tree

266 files changed

+2345
-2227
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

266 files changed

+2345
-2227
lines changed

TRYLATESTBITSINPROD.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ top of your web application and change the entrypoint to boot with these jars in
4949
./mvnw clean install
5050
```
5151

52-
Let's assume the current build version is `3.0.4-SNAPSHOT`.
52+
Let's assume the current build version is `4.0.0-SNAPSHOT`.
5353

5454
See the output of the runtime deployment module which contains all the jars needed by the runtime:
5555

@@ -70,7 +70,7 @@ Add the dependency for the GAE runtime jars in your application pom.xml file:
7070

7171
```
7272
<properties>
73-
<appengine.runtime.version>3.0.4-SNAPSHOT</appengine.runtime.version>
73+
<appengine.runtime.version>4.0.0-SNAPSHOT</appengine.runtime.version>
7474
<appengine.runtime.location>target/${project.artifactId}-${project.version}</appengine.runtime.location>
7575
<properties>
7676
...

api/pom.xml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<groupId>com.google.appengine</groupId>
2323
<artifactId>parent</artifactId>
24-
<version>3.0.4-SNAPSHOT</version>
24+
<version>4.0.0-SNAPSHOT</version>
2525
</parent>
2626
<properties>
2727
<maven.deploy.skip>true</maven.deploy.skip>
@@ -43,10 +43,7 @@
4343
<groupId>com.google.api-client</groupId>
4444
<artifactId>google-api-client</artifactId>
4545
</dependency>
46-
<dependency>
47-
<groupId>com.google.appengine</groupId>
48-
<artifactId>proto1</artifactId>
49-
</dependency>
46+
5047
<dependency>
5148
<groupId>com.google.appengine</groupId>
5249
<artifactId>appengine-utils</artifactId>

api/src/main/java/com/google/appengine/api/datastore/AdminDatastoreService.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
import com.google.appengine.api.datastore.Index.IndexState;
2424
import com.google.appengine.api.datastore.Query.FilterPredicate;
2525
import com.google.apphosting.api.AppEngineInternal;
26-
import com.google.apphosting.datastore.DatastoreV3Pb;
26+
import com.google.apphosting.datastore_bytes.proto2api.DatastoreV3Pb;
2727
import com.google.common.collect.Iterables;
2828
import com.google.common.collect.Lists;
29-
import com.google.storage.onestore.v3.OnestoreEntity;
29+
import com.google.storage.onestore.v3_bytes.proto2api.OnestoreEntity;
3030
import java.util.ArrayList;
3131
import java.util.Arrays;
3232
import java.util.Collection;
@@ -264,7 +264,7 @@ public Set<Index> compositeIndexesForQuery(Query query) {
264264
convertQueryToPbs(query, FetchOptions.Builder.withDefaults());
265265
Set<Index> resultSet = new HashSet<Index>();
266266
for (DatastoreV3Pb.Query queryProto : pbQueries) {
267-
IndexComponentsOnlyQuery indexQuery = new IndexComponentsOnlyQuery(queryProto);
267+
IndexComponentsOnlyQuery indexQuery = new IndexComponentsOnlyQuery(queryProto.toBuilder());
268268

269269
OnestoreEntity.Index index =
270270
factory.getCompositeIndexManager().compositeIndexForQuery(indexQuery);
@@ -291,7 +291,7 @@ public Set<Index> minimumCompositeIndexesForQuery(Query query, Collection<Index>
291291

292292
Set<Index> resultSet = new HashSet<Index>();
293293
for (DatastoreV3Pb.Query queryProto : pbQueries) {
294-
IndexComponentsOnlyQuery indexQuery = new IndexComponentsOnlyQuery(queryProto);
294+
IndexComponentsOnlyQuery indexQuery = new IndexComponentsOnlyQuery(queryProto.toBuilder());
295295

296296
OnestoreEntity.Index index =
297297
factory.getCompositeIndexManager().minimumCompositeIndexForQuery(indexQuery, indexPbs);
@@ -310,7 +310,7 @@ private static List<DatastoreV3Pb.Query> convertQueryToPbs(
310310
// All Filters should be in queriesToRun
311311
query.setFilter(null);
312312
query.getFilterPredicates().clear();
313-
List<DatastoreV3Pb.Query> resultQueries = new ArrayList<DatastoreV3Pb.Query>();
313+
List<DatastoreV3Pb.Query> resultQueries = new ArrayList<>();
314314
for (MultiQueryBuilder multiQuery : queriesToRun) {
315315
for (List<List<FilterPredicate>> parallelQueries : multiQuery) {
316316
for (List<FilterPredicate> singleQuery : parallelQueries) {

api/src/main/java/com/google/appengine/api/datastore/AsyncCloudDatastoreV1ServiceImpl.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import com.google.datastore.v1.ReadOptions;
4646
import com.google.datastore.v1.TransactionOptions.ReadOnly;
4747
import com.google.datastore.v1.TransactionOptions.ReadWrite;
48+
import com.google.protobuf.CodedOutputStream;
4849
import com.google.protobuf.InvalidProtocolBufferException;
4950
import com.google.protobuf.Message;
5051
import java.util.ArrayList;
@@ -117,6 +118,11 @@ final Object getGroup(Key key) {
117118
final Mutation toPb(Key value) {
118119
return Mutation.newBuilder().setDelete(DataTypeTranslator.toV1Key(value)).build();
119120
}
121+
122+
@Override
123+
protected int getEmbeddedSize(Mutation value) {
124+
return CodedOutputStream.computeMessageSize(CommitRequest.MUTATIONS_FIELD_NUMBER, value);
125+
}
120126
};
121127

122128
private final V1Batcher<LookupResponse, LookupRequest.Builder, Key, com.google.datastore.v1.Key>
@@ -146,6 +152,11 @@ final Object getGroup(Key key) {
146152
final com.google.datastore.v1.Key toPb(Key value) {
147153
return DataTypeTranslator.toV1Key(value).build();
148154
}
155+
156+
@Override
157+
protected int getEmbeddedSize(com.google.datastore.v1.Key value) {
158+
return CodedOutputStream.computeMessageSize(LookupRequest.KEYS_FIELD_NUMBER, value);
159+
}
149160
};
150161

151162
private final V1Batcher<
@@ -183,6 +194,11 @@ final Object getGroup(com.google.datastore.v1.Key key) {
183194
final com.google.datastore.v1.Key toPb(com.google.datastore.v1.Key value) {
184195
return value;
185196
}
197+
198+
@Override
199+
protected int getEmbeddedSize(com.google.datastore.v1.Key value) {
200+
return CodedOutputStream.computeMessageSize(LookupRequest.KEYS_FIELD_NUMBER, value);
201+
}
186202
};
187203

188204
private final V1Batcher<CommitResponse, CommitRequest.Builder, Entity, Mutation> putBatcher =
@@ -215,6 +231,11 @@ final Object getGroup(Entity value) {
215231
final Mutation toPb(Entity value) {
216232
return Mutation.newBuilder().setUpsert(DataTypeTranslator.toV1Entity(value)).build();
217233
}
234+
235+
@Override
236+
protected int getEmbeddedSize(Mutation value) {
237+
return CodedOutputStream.computeMessageSize(CommitRequest.MUTATIONS_FIELD_NUMBER, value);
238+
}
218239
};
219240

220241
private final V1Batcher<
@@ -254,6 +275,12 @@ final Object getGroup(Key key) {
254275
final com.google.datastore.v1.Key toPb(Key value) {
255276
return DataTypeTranslator.toV1Key(value).build();
256277
}
278+
279+
@Override
280+
protected int getEmbeddedSize(com.google.datastore.v1.Key value) {
281+
return CodedOutputStream.computeMessageSize(
282+
AllocateIdsRequest.KEYS_FIELD_NUMBER, value);
283+
}
257284
};
258285

259286
private final CloudDatastoreV1Client datastoreProxy;

0 commit comments

Comments
 (0)