Skip to content

Commit

Permalink
Migration from proto1 to proto2
Browse files Browse the repository at this point in the history
  • Loading branch information
srinjoyray committed Nov 12, 2024
1 parent 69b51c3 commit eba4cd7
Show file tree
Hide file tree
Showing 219 changed files with 136,867 additions and 2,270 deletions.
3 changes: 2 additions & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
wrapperVersion=3.3.1
wrapperVersion=3.3.2
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Source code for all public APIs for com.google.appengine.api.* packages.
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>2.0.29</version><!-- or later-->
<version>2.0.31</version><!-- or later-->
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
Expand All @@ -89,7 +89,7 @@ Source code for all public APIs for com.google.appengine.api.* packages.
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>2.0.29</version><!-- or later-->
<version>2.0.31</version><!-- or later-->
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
Expand Down Expand Up @@ -188,7 +188,7 @@ Source code for remote APIs for App Engine.
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-remote-api</artifactId>
<version>2.0.29</version><!-- Or later-->
<version>2.0.31</version><!-- Or later-->
</dependency>
```
Expand All @@ -211,7 +211,7 @@ We moved `com.google.appengine.api.memcache.stdimpl` and its old dependency
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-legacy.jar/artifactId>
<version>2.0.29</version><!-- Or later-->
<version>2.0.31</version><!-- Or later-->
</dependency>
```
Expand All @@ -226,19 +226,19 @@ We moved `com.google.appengine.api.memcache.stdimpl` and its old dependency
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-testing</artifactId>
<version>2.0.29</version><!-- Or later-->
<version>2.0.31</version><!-- Or later-->
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-stubs</artifactId>
<version>2.0.29</version><!-- Or later-->
<version>2.0.31</version><!-- Or later-->
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-tools-sdk</artifactId>
<version>2.0.29</version><!-- Or later-->
<version>2.0.31</version><!-- Or later-->
<scope>test</scope>
</dependency>
```
Expand Down
4 changes: 2 additions & 2 deletions TRYLATESTBITSINPROD.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ top of your web application and change the entrypoint to boot with these jars in
./mvnw clean install
```

Let's assume the current build version is `2.0.30-SNAPSHOT`.
Let's assume the current build version is `2.0.32-SNAPSHOT`.

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

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

```
<properties>
<appengine.runtime.version>2.0.30-SNAPSHOT</appengine.runtime.version>
<appengine.runtime.version>2.0.32-SNAPSHOT</appengine.runtime.version>
<appengine.runtime.location>target/${project.artifactId}-${project.version}</appengine.runtime.location>
<properties>
...
Expand Down
9 changes: 3 additions & 6 deletions api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>com.google.appengine</groupId>
<artifactId>parent</artifactId>
<version>2.0.30-SNAPSHOT</version>
<version>2.0.32-SNAPSHOT</version>
</parent>
<properties>
<maven.deploy.skip>true</maven.deploy.skip>
Expand All @@ -42,10 +42,7 @@
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>proto1</artifactId>
</dependency>

<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-utils</artifactId>
Expand Down Expand Up @@ -239,7 +236,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.10.0</version>
<version>3.11.1</version>
<configuration>
<doclet>com.microsoft.doclet.DocFxDoclet</doclet>
<useStandardDocletOptions>false</useStandardDocletOptions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
import com.google.appengine.api.datastore.Index.IndexState;
import com.google.appengine.api.datastore.Query.FilterPredicate;
import com.google.apphosting.api.AppEngineInternal;
import com.google.apphosting.datastore.DatastoreV3Pb;
import com.google.apphosting.datastore.proto2api.DatastoreV3Pb;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.storage.onestore.v3.OnestoreEntity;
import com.google.storage.onestore.v3.proto2api.OnestoreEntity;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
Expand Down Expand Up @@ -260,16 +260,16 @@ public Index compositeIndexForQuery(Query query) {
}

public Set<Index> compositeIndexesForQuery(Query query) {
List<DatastoreV3Pb.Query> pbQueries =
List<DatastoreV3Pb.Query.Builder> pbQueries =
convertQueryToPbs(query, FetchOptions.Builder.withDefaults());
Set<Index> resultSet = new HashSet<Index>();
for (DatastoreV3Pb.Query queryProto : pbQueries) {
for (DatastoreV3Pb.Query.Builder queryProto : pbQueries) {
IndexComponentsOnlyQuery indexQuery = new IndexComponentsOnlyQuery(queryProto);

OnestoreEntity.Index index =
OnestoreEntity.Index.Builder index =
factory.getCompositeIndexManager().compositeIndexForQuery(indexQuery);
if (index != null) {
resultSet.add(IndexTranslator.convertFromPb(index));
resultSet.add(IndexTranslator.convertFromPb(index.build()));
}
}
return resultSet;
Expand All @@ -281,7 +281,7 @@ public Index minimumCompositeIndexForQuery(Query query, Collection<Index> indexe
}

public Set<Index> minimumCompositeIndexesForQuery(Query query, Collection<Index> indexes) {
List<DatastoreV3Pb.Query> pbQueries =
List<DatastoreV3Pb.Query.Builder> pbQueries =
convertQueryToPbs(query, FetchOptions.Builder.withDefaults());

List<OnestoreEntity.Index> indexPbs = Lists.newArrayListWithCapacity(indexes.size());
Expand All @@ -290,33 +290,34 @@ public Set<Index> minimumCompositeIndexesForQuery(Query query, Collection<Index>
}

Set<Index> resultSet = new HashSet<Index>();
for (DatastoreV3Pb.Query queryProto : pbQueries) {
for (DatastoreV3Pb.Query.Builder queryProto : pbQueries) {
IndexComponentsOnlyQuery indexQuery = new IndexComponentsOnlyQuery(queryProto);

OnestoreEntity.Index index =
OnestoreEntity.Index.Builder index =
factory.getCompositeIndexManager().minimumCompositeIndexForQuery(indexQuery, indexPbs);
if (index != null) {
resultSet.add(IndexTranslator.convertFromPb(index));
resultSet.add(IndexTranslator.convertFromPb(index.build()));
}
}
return resultSet;
}

/** Convert a query to a list of ProtocolBuffer Queries. */
@SuppressWarnings("deprecation")
private static List<DatastoreV3Pb.Query> convertQueryToPbs(
private static List<DatastoreV3Pb.Query.Builder> convertQueryToPbs(
Query query, FetchOptions fetchOptions) {
List<MultiQueryBuilder> queriesToRun = QuerySplitHelper.splitQuery(query);
// All Filters should be in queriesToRun
query.setFilter(null);
query.getFilterPredicates().clear();
List<DatastoreV3Pb.Query> resultQueries = new ArrayList<DatastoreV3Pb.Query>();
// query.getFilterPredicates().clear();
List<DatastoreV3Pb.Query.Builder> resultQueries = new ArrayList<DatastoreV3Pb.Query.Builder>();
for (MultiQueryBuilder multiQuery : queriesToRun) {
for (List<List<FilterPredicate>> parallelQueries : multiQuery) {
for (List<FilterPredicate> singleQuery : parallelQueries) {
Query newQuery = new Query(query);
newQuery.getFilterPredicates().addAll(singleQuery);
DatastoreV3Pb.Query queryProto = QueryTranslator.convertToPb(newQuery, fetchOptions);
// Query newQuery = new Query(query);
query.getFilterPredicates().clear();
query.getFilterPredicates().addAll(singleQuery);
DatastoreV3Pb.Query.Builder queryProto = QueryTranslator.convertToPb(query, fetchOptions);
resultQueries.add(queryProto);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.appengine.api.datastore.FutureHelper.MultiFuture;
import com.google.appengine.api.datastore.Index.IndexState;
import com.google.appengine.api.utils.FutureWrapper;
import com.google.apphosting.datastore.proto2api.DatastoreV3Pb.GetResponse;
import com.google.common.base.Preconditions;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableList;
Expand Down
Loading

0 comments on commit eba4cd7

Please sign in to comment.