-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(datastore): add support for request tags #13732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rahulmane-goog
wants to merge
4
commits into
googleapis:main
Choose a base branch
from
rahulmane-goog:feat-datastore-request-tags
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a63342a
feat(datastore): add support for request tags
rahulmane-goog aab1fd3
fix: address code review comments regarding instance-level tags and d…
rahulmane-goog eb08e39
Merge branch 'main' into feat-datastore-request-tags
rahulmane-goog 6c23afc
Merge branch 'main' into feat-datastore-request-tags
rahulmane-goog File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,8 @@ | |
| import com.google.api.core.InternalExtensionOnly; | ||
| import com.google.cloud.Service; | ||
| import com.google.cloud.datastore.models.ExplainOptions; | ||
| import com.google.common.collect.ImmutableList; | ||
| import com.google.datastore.v1.RequestOptions; | ||
| import com.google.datastore.v1.TransactionOptions; | ||
| import java.util.Iterator; | ||
| import java.util.List; | ||
|
|
@@ -492,6 +494,30 @@ interface TransactionCallable<T> { | |
| @BetaApi | ||
| <T> QueryResults<T> run(Query<T> query, ExplainOptions explainOptions, ReadOption... options); | ||
|
|
||
| /** | ||
| * Submits a {@link Query} with specified {@link com.google.datastore.v1.RequestOptions} and | ||
| * returns its result. | ||
| */ | ||
| <T> QueryResults<T> run(Query<T> query, RequestOptions requestOptions); | ||
|
|
||
| /** | ||
| * Submits a {@link Query} with specified {@link com.google.datastore.v1.RequestOptions} and | ||
| * returns its result. {@link ReadOption}s can be specified if desired. | ||
| */ | ||
| <T> QueryResults<T> run(Query<T> query, RequestOptions requestOptions, ReadOption... options); | ||
|
|
||
| /** | ||
| * Submits a {@link Query} with specified {@link com.google.cloud.datastore.models.ExplainOptions} | ||
| * and {@link com.google.datastore.v1.RequestOptions} and returns its result. {@link ReadOption}s | ||
| * can be specified if desired. | ||
| */ | ||
| @BetaApi | ||
| <T> QueryResults<T> run( | ||
| Query<T> query, | ||
| ExplainOptions explainOptions, | ||
| RequestOptions requestOptions, | ||
| ReadOption... options); | ||
|
|
||
| /** | ||
| * Submits a {@link AggregationQuery} and returns {@link AggregationResults}. {@link ReadOption}s | ||
| * can be specified if desired. | ||
|
|
@@ -537,6 +563,20 @@ interface TransactionCallable<T> { | |
| */ | ||
| AggregationResults runAggregation(AggregationQuery query, ReadOption... options); | ||
|
|
||
| /** | ||
| * Submits an {@link AggregationQuery} with specified {@link | ||
| * com.google.datastore.v1.RequestOptions} and returns {@link AggregationResults}. | ||
| */ | ||
| AggregationResults runAggregation(AggregationQuery query, RequestOptions requestOptions); | ||
|
|
||
| /** | ||
| * Submits an {@link AggregationQuery} with specified {@link | ||
| * com.google.datastore.v1.RequestOptions} and returns {@link AggregationResults}. {@link | ||
| * ReadOption}s can be specified if desired. | ||
| */ | ||
| AggregationResults runAggregation( | ||
| AggregationQuery query, RequestOptions requestOptions, ReadOption... options); | ||
|
|
||
| /** | ||
| * Submits a {@link AggregationQuery} with specified {@link | ||
| * com.google.cloud.datastore.models.ExplainOptions} and returns {@link AggregationResults}. | ||
|
|
@@ -564,6 +604,28 @@ interface TransactionCallable<T> { | |
| AggregationResults runAggregation( | ||
| AggregationQuery query, ExplainOptions explainOptions, ReadOption... options); | ||
|
|
||
| /** | ||
| * Submits an {@link AggregationQuery} with specified {@link | ||
| * com.google.cloud.datastore.models.ExplainOptions} and {@link | ||
| * com.google.datastore.v1.RequestOptions} and returns {@link AggregationResults}. | ||
| */ | ||
| @BetaApi | ||
| AggregationResults runAggregation( | ||
| AggregationQuery query, ExplainOptions explainOptions, RequestOptions requestOptions); | ||
|
|
||
| /** | ||
| * Submits an {@link AggregationQuery} with specified {@link | ||
| * com.google.cloud.datastore.models.ExplainOptions} and {@link | ||
| * com.google.datastore.v1.RequestOptions} and returns {@link AggregationResults}. {@link | ||
| * ReadOption}s can be specified if desired. | ||
| */ | ||
| @BetaApi | ||
| AggregationResults runAggregation( | ||
| AggregationQuery query, | ||
| ExplainOptions explainOptions, | ||
| RequestOptions requestOptions, | ||
| ReadOption... options); | ||
|
|
||
| /** | ||
| * Closes the gRPC channels associated with this instance and frees up their resources. This | ||
| * method blocks until all channels are closed. Once this method is called, this Datastore client | ||
|
|
@@ -574,4 +636,25 @@ AggregationResults runAggregation( | |
|
|
||
| /** Returns true if this background resource has been shut down. */ | ||
| boolean isClosed(); | ||
|
|
||
| /** | ||
| * Returns a new Datastore client with the specified request tags added. | ||
| * | ||
| * @param requestTags the request tags to append to existing ones | ||
| */ | ||
| default Datastore withRequestTags(String... requestTags) { | ||
| return withRequestTags(java.util.Arrays.asList(requestTags)); | ||
| } | ||
|
jinseopkim0 marked this conversation as resolved.
rahulmane-goog marked this conversation as resolved.
|
||
|
|
||
| /** | ||
| * Returns a new Datastore client with the specified request tags added. | ||
| * | ||
| * @param requestTags the request tags to append to existing ones | ||
| */ | ||
| default Datastore withRequestTags(List<String> requestTags) { | ||
| ImmutableList.Builder<String> builder = ImmutableList.builder(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can the e.g. |
||
| builder.addAll(getOptions().getRequestTags()); | ||
| builder.addAll(requestTags); | ||
| return getOptions().toBuilder().setTags(builder.build()).build().getService(); | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.