Skip to content

Commit d6214bb

Browse files
committed
merging conflicts
2 parents 8146530 + 1154c29 commit d6214bb

File tree

73 files changed

+10233
-249
lines changed

Some content is hidden

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

73 files changed

+10233
-249
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"

.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: 97 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,103 @@ git clone -b grpc-experimental https://github.com/googleapis/java-datastore.git
219219
# Go to the directory the code was downloaded to
220220
cd java-datastore/
221221

222+
# Build the library
223+
mvn clean install -DskipTests=true
224+
```
225+
3. Add the following dependency to your project:
226+
```xml
227+
<dependency>
228+
<groupId>com.google.cloud</groupId>
229+
<artifactId>google-cloud-datastore</artifactId>
230+
<version>2.22.0-grpc-experimental-1-SNAPSHOT</version>
231+
</dependency>
232+
```
233+
234+
#### How to Use
235+
To opt-in to the gRPC transport behavior, simply add the below line of code (`setTransportOptions`) to your Datastore client instantiation.
236+
237+
Example:
238+
```java
239+
DatastoreOptions datastoreOptions =
240+
DatastoreOptions.newBuilder()
241+
.setProjectId("my-project")
242+
.setDatabaseId("my-database")
243+
.setTransportOptions(GrpcTransportOptions.newBuilder().build())
244+
.build();
245+
```
246+
Setting the transport options explicitly to `GrpcTransportOptions` will signal the client to use gRPC instead of HTTP when making calls to the server.
247+
248+
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.
249+
Example:
250+
```java
251+
// will default to existing HTTP transport behavior
252+
DatastoreOptions datastoreOptions = DatastoreOptions.newBuilder()
253+
.setProjectId("my-project")
254+
.setDatabaseId("my-database")
255+
.build();
256+
257+
// will also default to existing HTTP transport behavior
258+
DatastoreOptions datastoreOptions =
259+
DatastoreOptions.newBuilder()
260+
.setProjectId("my-project")
261+
.setDatabaseId("my-database")
262+
.setTransportOptions(HttpTransportOptions.newBuilder()
263+
.setConnectTimeout(1000)
264+
.build()).build();
265+
```
266+
267+
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.
268+
269+
#### Verify Datastore Transport Options Type
270+
To verify which type of TransportOptions you have successfully configured, you can use the below lines of code to compare transport options type:
271+
```java
272+
// checks if using gRPC transport options
273+
boolean isGRPC = datastore.getOptions().getTransportOptions() instanceof GrpcTransportOptions;
274+
275+
// checks if using HTTP transport options
276+
boolean isHTTP = datastore.getOptions().getTransportOptions() instanceof HTTPTransportOptions;
277+
```
278+
279+
#### New Features
280+
There are new gRPC specific features available to use in this update.
281+
282+
##### Channel Pooling
283+
To customize the number of channels your client uses, you can update the channel provider in the DatastoreOptions.
284+
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.
285+
286+
Example:
287+
```java
288+
InstantiatingGrpcChannelProvider channelProvider =
289+
DatastoreSettings.defaultGrpcTransportProviderBuilder()
290+
.setChannelPoolSettings(
291+
ChannelPoolSettings.builder()
292+
.setInitialChannelCount(MIN_VAL)
293+
.setMaxChannelCount(MAX_VAL)
294+
.build())
295+
.build();
296+
297+
DatastoreOptions options = DatastoreOptions.newBuilder()
298+
.setProjectId("my-project")
299+
.setChannelProvider(channelProvider)
300+
.setTransportOptions(GrpcTransportOptions.newBuilder().build())
301+
.build();
302+
```
303+
304+
gRPC Java Datastore Client User Guide
305+
-------
306+
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.
307+
308+
#### Download Instructions
309+
Instructions:
310+
1. Clone the grpc-experimental branch from GitHub:
311+
```python
312+
git clone -b grpc-experimental https://github.com/googleapis/java-datastore.git
313+
```
314+
2. Run the following commands to build the library:
315+
```python
316+
# Go to the directory the code was downloaded to
317+
cd java-datastore/
318+
222319
# Build the library
223320
mvn clean install -DskipTests=true
224321
```
@@ -368,9 +465,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/java-datastore/tre
368465
| Sum Aggregation With Limit | [source code](https://github.com/googleapis/java-datastore/blob/main/samples/snippets/src/main/java/com/example/datastore/aggregation/SumAggregationWithLimit.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-datastore&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/datastore/aggregation/SumAggregationWithLimit.java) |
369466
| Sum Aggregation With Order By | [source code](https://github.com/googleapis/java-datastore/blob/main/samples/snippets/src/main/java/com/example/datastore/aggregation/SumAggregationWithOrderBy.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-datastore&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/datastore/aggregation/SumAggregationWithOrderBy.java) |
370467
| Sum Aggregation With Property Filter | [source code](https://github.com/googleapis/java-datastore/blob/main/samples/snippets/src/main/java/com/example/datastore/aggregation/SumAggregationWithPropertyFilter.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-datastore&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/datastore/aggregation/SumAggregationWithPropertyFilter.java) |
371-
| Indexing Consideration Query | [source code](https://github.com/googleapis/java-datastore/blob/main/samples/snippets/src/main/java/com/example/datastore/filters/IndexingConsiderationQuery.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-datastore&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/datastore/filters/IndexingConsiderationQuery.java) |
372468
| Create a union between two filters | [source code](https://github.com/googleapis/java-datastore/blob/main/samples/snippets/src/main/java/com/example/datastore/filters/OrFilterQuery.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-datastore&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/datastore/filters/OrFilterQuery.java) |
373-
| Order Fields Query | [source code](https://github.com/googleapis/java-datastore/blob/main/samples/snippets/src/main/java/com/example/datastore/filters/OrderFieldsQuery.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-datastore&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/datastore/filters/OrderFieldsQuery.java) |
374469
| Query Profile Explain | [source code](https://github.com/googleapis/java-datastore/blob/main/samples/snippets/src/main/java/com/example/datastore/queryprofile/QueryProfileExplain.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-datastore&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/datastore/queryprofile/QueryProfileExplain.java) |
375470
| Query Profile Explain Aggregation | [source code](https://github.com/googleapis/java-datastore/blob/main/samples/snippets/src/main/java/com/example/datastore/queryprofile/QueryProfileExplainAggregation.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-datastore&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/datastore/queryprofile/QueryProfileExplainAggregation.java) |
376471
| Query Profile Explain Analyze | [source code](https://github.com/googleapis/java-datastore/blob/main/samples/snippets/src/main/java/com/example/datastore/queryprofile/QueryProfileExplainAnalyze.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-datastore&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/datastore/queryprofile/QueryProfileExplainAnalyze.java) |

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.3</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.3</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.3</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.3</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.3</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.3</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.3</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>

0 commit comments

Comments
 (0)