Skip to content

Commit 402ad47

Browse files
committed
merge conflicts from grpc-experimental
2 parents dc9258c + 782c4cb commit 402ad47

File tree

74 files changed

+9624
-256
lines changed

Some content is hidden

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

74 files changed

+9624
-256
lines changed

.github/.OwlBot-hermetic.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ deep-copy-regex:
2222
dest: "/owl-bot-staging/$1/proto-google-cloud-datastore-$1/src"
2323
- source: "/google/datastore/admin/(v.*)/.*-java/proto-google-.*/src"
2424
dest: "/owl-bot-staging/$1/proto-google-cloud-datastore-admin-$1/src"
25+
- source: "/google/datastore/(v.*)/.*-java/grpc-google-.*/src"
26+
dest: "/owl-bot-staging/$1/grpc-google-cloud-datastore-$1/src"
2527
- source: "/google/datastore/admin/(v.*)/.*-java/grpc-google-.*/src"
2628
dest: "/owl-bot-staging/$1/grpc-google-cloud-datastore-admin-$1/src"
2729
# Admin & Data APIs share the same wrapper library.
30+
- source: "/google/datastore/(v.*)/.*-java/gapic-google-.*/src"
31+
dest: "/owl-bot-staging/$1/google-cloud-datastore/src"
2832
- source: "/google/datastore/admin/(v.*)/.*-java/gapic-google-.*/src"
2933
dest: "/owl-bot-staging/$1/google-cloud-datastore/src"

.github/dependabot.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
version: 2
2-
32
updates:
43
- package-ecosystem: "maven"
54
directory: "/"
@@ -18,14 +17,3 @@ updates:
1817
# it via template in the synthtool repository.
1918
ignore:
2019
- dependency-name: "*"
21-
22-
# rules for the `V3-experimental` branch
23-
- package-ecosystem: maven
24-
directory: "/"
25-
schedule:
26-
interval: daily
27-
commit-message:
28-
# Prefix all commit messages with "deps: "
29-
prefix: "deps"
30-
open-pull-requests-limit: 10
31-
target-branch: "V3-experimental"

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ target/
33
*.iml
44
__pycache__/
55

6-
.flattened-pom.xml
6+
.flattened-pom.xml

.readme-partials.yaml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,103 @@ custom_content: |
121121
# Go to the directory the code was downloaded to
122122
cd java-datastore/
123123
124+
# Build the library
125+
mvn clean install -DskipTests=true
126+
```
127+
3. Add the following dependency to your project:
128+
```xml
129+
<dependency>
130+
<groupId>com.google.cloud</groupId>
131+
<artifactId>google-cloud-datastore</artifactId>
132+
<version>2.22.0-grpc-experimental-1-SNAPSHOT</version>
133+
</dependency>
134+
```
135+
136+
#### How to Use
137+
To opt-in to the gRPC transport behavior, simply add the below line of code (`setTransportOptions`) to your Datastore client instantiation.
138+
139+
Example:
140+
```java
141+
DatastoreOptions datastoreOptions =
142+
DatastoreOptions.newBuilder()
143+
.setProjectId("my-project")
144+
.setDatabaseId("my-database")
145+
.setTransportOptions(GrpcTransportOptions.newBuilder().build())
146+
.build();
147+
```
148+
Setting the transport options explicitly to `GrpcTransportOptions` will signal the client to use gRPC instead of HTTP when making calls to the server.
149+
150+
To revert back to the existing stable behavior and transport, simply remove the transport options line or replace it with `HttpTransportOptions`. Please note this will require an application rebuild and restart.
151+
Example:
152+
```java
153+
// will default to existing HTTP transport behavior
154+
DatastoreOptions datastoreOptions = DatastoreOptions.newBuilder()
155+
.setProjectId("my-project")
156+
.setDatabaseId("my-database")
157+
.build();
158+
159+
// will also default to existing HTTP transport behavior
160+
DatastoreOptions datastoreOptions =
161+
DatastoreOptions.newBuilder()
162+
.setProjectId("my-project")
163+
.setDatabaseId("my-database")
164+
.setTransportOptions(HttpTransportOptions.newBuilder()
165+
.setConnectTimeout(1000)
166+
.build()).build();
167+
```
168+
169+
Note: client instantiations that already use `setTransportOptions` with `HttpTransportOptions` will continue to have the same behavior. Only transports that are explicitly set to gRPC will change.
170+
171+
#### Verify Datastore Transport Options Type
172+
To verify which type of TransportOptions you have successfully configured, you can use the below lines of code to compare transport options type:
173+
```java
174+
// checks if using gRPC transport options
175+
boolean isGRPC = datastore.getOptions().getTransportOptions() instanceof GrpcTransportOptions;
176+
177+
// checks if using HTTP transport options
178+
boolean isHTTP = datastore.getOptions().getTransportOptions() instanceof HTTPTransportOptions;
179+
```
180+
181+
#### New Features
182+
There are new gRPC specific features available to use in this update.
183+
184+
##### Channel Pooling
185+
To customize the number of channels your client uses, you can update the channel provider in the DatastoreOptions.
186+
See [ChannelPoolSettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.grpc.ChannelPoolSettings) and [Performance Best Practices](https://grpc.io/docs/guides/performance/) for more information on channel pools and best practices for performance.
187+
188+
Example:
189+
```java
190+
InstantiatingGrpcChannelProvider channelProvider =
191+
DatastoreSettings.defaultGrpcTransportProviderBuilder()
192+
.setChannelPoolSettings(
193+
ChannelPoolSettings.builder()
194+
.setInitialChannelCount(MIN_VAL)
195+
.setMaxChannelCount(MAX_VAL)
196+
.build())
197+
.build();
198+
199+
DatastoreOptions options = DatastoreOptions.newBuilder()
200+
.setProjectId("my-project")
201+
.setChannelProvider(channelProvider)
202+
.setTransportOptions(GrpcTransportOptions.newBuilder().build())
203+
.build();
204+
```
205+
206+
gRPC Java Datastore Client User Guide
207+
-------
208+
In this feature launch, the [Java Datastore client](https://github.com/googleapis/java-datastore) now offers gRPC as a transport layer option with experimental support. Using [gRPC connection pooling](https://grpc.io/docs/guides/performance/) enables distributing RPCs over multiple connections which may improve performance.
209+
210+
#### Download Instructions
211+
Instructions:
212+
1. Clone the grpc-experimental branch from GitHub:
213+
```python
214+
git clone -b grpc-experimental https://github.com/googleapis/java-datastore.git
215+
```
216+
2. Run the following commands to build the library:
217+
```python
218+
# Go to the directory the code was downloaded to
219+
cd java-datastore/
220+
124221
# Build the library
125222
mvn clean install -DskipTests=true
126223
```

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ mvn clean install -DskipTests=true
227227
<dependency>
228228
<groupId>com.google.cloud</groupId>
229229
<artifactId>google-cloud-datastore</artifactId>
230-
<version>2.20.0-grpc-experimental-1-SNAPSHOT</version>
230+
<version>2.22.0-grpc-experimental-1-SNAPSHOT</version>
231231
</dependency>
232232
```
233233

datastore-v1-proto-client/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
<modelVersion>4.0.0</modelVersion>
2020
<groupId>com.google.cloud.datastore</groupId>
2121
<artifactId>datastore-v1-proto-client</artifactId>
22-
<version>2.24.2</version><!-- {x-version-update:datastore-v1-proto-client:current} -->
22+
<version>2.22.0-grpc-experimental-1-SNAPSHOT</version><!-- {x-version-update:datastore-v1-proto-client:current} -->
2323

2424
<parent>
2525
<groupId>com.google.cloud</groupId>
2626
<artifactId>google-cloud-datastore-parent</artifactId>
27-
<version>2.24.2</version><!-- {x-version-update:google-cloud-datastore:current} -->
27+
<version>2.22.0-grpc-experimental-1-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore:current} -->
2828
</parent>
2929

3030
<packaging>jar</packaging>

google-cloud-datastore-bom/pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.google.cloud</groupId>
55
<artifactId>google-cloud-datastore-bom</artifactId>
6-
<version>2.24.2</version><!-- {x-version-update:google-cloud-datastore-bom:current} -->
6+
<version>2.22.0-grpc-experimental-1-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore-bom:current} -->
77
<packaging>pom</packaging>
88
<parent>
99
<groupId>com.google.cloud</groupId>
@@ -52,22 +52,22 @@
5252
<dependency>
5353
<groupId>com.google.cloud</groupId>
5454
<artifactId>google-cloud-datastore</artifactId>
55-
<version>2.24.2</version><!-- {x-version-update:google-cloud-datastore:current} -->
55+
<version>2.22.0-grpc-experimental-1-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore:current} -->
5656
</dependency>
5757
<dependency>
5858
<groupId>com.google.api.grpc</groupId>
5959
<artifactId>grpc-google-cloud-datastore-admin-v1</artifactId>
60-
<version>2.24.2</version><!-- {x-version-update:grpc-google-cloud-datastore-admin-v1:current} -->
60+
<version>2.22.0-grpc-experimental-1-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-datastore-admin-v1:current} -->
6161
</dependency>
6262
<dependency>
6363
<groupId>com.google.api.grpc</groupId>
6464
<artifactId>proto-google-cloud-datastore-v1</artifactId>
65-
<version>0.115.2</version><!-- {x-version-update:proto-google-cloud-datastore-v1:current} -->
65+
<version>0.113.0-grpc-experimental-1-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-datastore-v1:current} -->
6666
</dependency>
6767
<dependency>
6868
<groupId>com.google.api.grpc</groupId>
6969
<artifactId>proto-google-cloud-datastore-admin-v1</artifactId>
70-
<version>2.24.2</version><!-- {x-version-update:proto-google-cloud-datastore-admin-v1:current} -->
70+
<version>2.22.0-grpc-experimental-1-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-datastore-admin-v1:current} -->
7171
</dependency>
7272
</dependencies>
7373
</dependencyManagement>

google-cloud-datastore/clirr-ignored-differences.xml

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,50 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!-- see http://mojo.codehaus.org/clirr-maven-plugin/examples/ignored-differences.html -->
33
<differences>
4-
<!-- added a default method to an interface-->
4+
<!-- renaming internal only class-->
5+
<difference>
6+
<className>com/google/cloud/datastore/ReadOption$QueryAndReadOptions</className>
7+
<method>*</method>
8+
<differenceType>8001</differenceType>
9+
</difference>
10+
<difference>
11+
<className>com/google/cloud/datastore/execution/request/AggregationQueryRequestProtoPreparer</className>
12+
<method>*QueryAndReadOptions*</method>
13+
<to>*QueryConfig*</to>
14+
<differenceType>7005</differenceType>
15+
</difference>
16+
<difference>
17+
<!-- Added BaseGrpcServiceException as a superclass -->
18+
<className>com/google/cloud/datastore/DatastoreException</className>
19+
<differenceType>5000</differenceType>
20+
<to>com/google/cloud/grpc/BaseGrpcServiceException</to>
21+
</difference>
22+
<difference>
23+
<!-- Removed BaseHttpServiceException as a superclass -->
24+
<className>com/google/cloud/datastore/DatastoreException</className>
25+
<differenceType>5001</differenceType>
26+
<to>com/google/cloud/http/BaseHttpServiceException</to>
27+
</difference>
28+
<difference>
29+
<className>com/google/cloud/datastore/Datastore</className>
30+
<method>void close()</method>
31+
<differenceType>7012</differenceType>
32+
</difference>
33+
<difference>
34+
<className>com/google/cloud/datastore/spi/v1/DatastoreRpc</className>
35+
<method>void close()</method>
36+
<differenceType>7012</differenceType>
37+
</difference>
38+
<difference>
39+
<className>com/google/cloud/datastore/Datastore</className>
40+
<method>boolean isClosed()</method>
41+
<differenceType>7012</differenceType>
42+
</difference>
43+
<difference>
44+
<className>com/google/cloud/datastore/spi/v1/DatastoreRpc</className>
45+
<method>boolean isClosed()</method>
46+
<differenceType>7012</differenceType>
47+
</difference>
548
<difference>
649
<className>com/google/cloud/datastore/Datastore</className>
750
<method>com.google.cloud.datastore.QueryResults run(com.google.cloud.datastore.Query, com.google.cloud.datastore.models.ExplainOptions, com.google.cloud.datastore.ReadOption[])</method>
@@ -14,7 +57,7 @@
1457
</difference>
1558
<difference>
1659
<className>com/google/cloud/datastore/DatastoreReader</className>
17-
<method> com.google.cloud.datastore.AggregationResults runAggregation(com.google.cloud.datastore.AggregationQuery, com.google.cloud.datastore.models.ExplainOptions)</method>
60+
<method>com.google.cloud.datastore.AggregationResults runAggregation(com.google.cloud.datastore.AggregationQuery, com.google.cloud.datastore.models.ExplainOptions)</method>
1861
<differenceType>7012</differenceType>
1962
</difference>
2063
<difference>
@@ -28,18 +71,6 @@
2871
<differenceType>7012</differenceType>
2972
</difference>
3073

31-
<!-- changed parmeters on internal only class-->
32-
<difference>
33-
<className>com/google/cloud/datastore/ReadOption$QueryConfig</className>
34-
<method>com.google.cloud.datastore.ReadOption$QueryConfig create(com.google.cloud.datastore.Query, java.util.List)</method>
35-
<to>*com.google.datastore.v1.ExplainOptions*</to>
36-
<differenceType>7005</differenceType>
37-
</difference>
38-
<difference>
39-
<className>com/google/cloud/datastore/ReadOption$QueryConfig</className>
40-
<method>com.google.cloud.datastore.ReadOption$QueryConfig create(com.google.cloud.datastore.Query)</method>
41-
<differenceType>7004</differenceType>
42-
</difference>
4374
<difference>
4475
<className>com/google/cloud/datastore/execution/AggregationQueryExecutor</className>
4576
<method>com.google.cloud.datastore.AggregationResults execute(com.google.cloud.datastore.AggregationQuery, com.google.cloud.datastore.ReadOption[])</method>

google-cloud-datastore/pom.xml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
33
<modelVersion>4.0.0</modelVersion>
44
<artifactId>google-cloud-datastore</artifactId>
5-
<version>2.24.2</version><!-- {x-version-update:google-cloud-datastore:current} -->
5+
<version>2.22.0-grpc-experimental-1-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore:current} -->
66
<packaging>jar</packaging>
77
<name>Google Cloud Datastore</name>
88
<url>https://github.com/googleapis/java-datastore</url>
@@ -12,7 +12,7 @@
1212
<parent>
1313
<groupId>com.google.cloud</groupId>
1414
<artifactId>google-cloud-datastore-parent</artifactId>
15-
<version>2.24.2</version><!-- {x-version-update:google-cloud-datastore:current} -->
15+
<version>2.22.0-grpc-experimental-1-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore:current} -->
1616
</parent>
1717
<properties>
1818
<site.installationModule>google-cloud-datastore</site.installationModule>
@@ -31,6 +31,10 @@
3131
</dependencies>
3232
</dependencyManagement>
3333
<dependencies>
34+
<dependency>
35+
<groupId>com.google.api.grpc</groupId>
36+
<artifactId>grpc-google-cloud-datastore-v1</artifactId>
37+
</dependency>
3438
<dependency>
3539
<groupId>com.google.api.grpc</groupId>
3640
<artifactId>grpc-google-cloud-datastore-admin-v1</artifactId>
@@ -39,6 +43,10 @@
3943
<groupId>com.google.cloud</groupId>
4044
<artifactId>google-cloud-core-http</artifactId>
4145
</dependency>
46+
<dependency>
47+
<groupId>com.google.cloud</groupId>
48+
<artifactId>google-cloud-core-grpc</artifactId>
49+
</dependency>
4250
<dependency>
4351
<groupId>com.google.api.grpc</groupId>
4452
<artifactId>proto-google-cloud-datastore-v1</artifactId>

google-cloud-datastore/src/main/java/com/google/cloud/datastore/Batch.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.google.cloud.datastore;
1818

19+
import com.google.api.core.InternalExtensionOnly;
1920
import java.util.List;
2021
import javax.annotation.concurrent.NotThreadSafe;
2122

@@ -42,6 +43,7 @@
4243
* This class too should not be treated as a thread safe class. </b>
4344
*/
4445
@NotThreadSafe
46+
@InternalExtensionOnly
4547
public interface Batch extends DatastoreBatchWriter {
4648

4749
interface Response {

0 commit comments

Comments
 (0)