Skip to content
This repository was archived by the owner on Feb 24, 2026. It is now read-only.

Commit a296d43

Browse files
cindy-pengkolea2jainsahabgcf-owl-bot[bot]dependabot[bot]
authored
feat: Java datastore gapic upgrade (#1824)
* feat: enable experimental grpc support (#1419) * chore: Importing auto-generated code from googleapis-gen (#1235) * Script to setup generated code from googleapis-gen * fixing script and gitignore * adding generated code * add maven config for new grpc module * fixing script * owlbot config to fetch grpc and gapic modules for V1 * fix lint * Revert "add maven config for new grpc module" This reverts commit 7769d8083a84f3ae9255c51c3ecb01fbfdd49320. * Reapply "add maven config for new grpc module" This reverts commit 759475d121afa772f66f549958e8b092cf3c5f0a. * remove unused dependency * fix library version * fix library version * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * removing exclusion of grpc-google-cloud-datastore-v1 module from repo metadata * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot * refactor: Swap usage of HttpDatastoreRpc with GrpcDatastoreRpc (#1240) * Create basic structure of GrpcDatastoreRpc and using it in DatastoreOptions * applying unary settings to all the unary methods * Configuring header provider for GrpcDatastoreRpc * fixing emulator tests to be able to run successfully with grpc now * ignoring one more test which will be fixed in actionable error implementation * Making HttpDatastoreRpc completely unused * Making GrpcDatastoreRpc implement AutoCloseable * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * incorporating feedbacks * pinging emulator after each test for debugging * Revert "pinging emulator after each test for debugging" This reverts commit 60ee45d27412aab8140fc7065010633cf59a0ae8. * Reapply "pinging emulator after each test for debugging" This reverts commit d42e3b995fe56ded8c5f080a262e8ea02c00c9d9. * more debugging * Constant ping to avoid flaky behaviour of /shutdown endpoint * fixing test * checking if emulator is running before sending a shutdown command * fix lint * implement helper method for localhost * fix header lint * moving emulator health check to src/test * fix lint * adding no extra headers * minor cleanup * using mutlipleAttemptsRule in DatastoreTest * Revert "adding no extra headers" This reverts commit 9b43798422dc0627b1b2bc6dea8b9f4169682292. * using classRule --------- Co-authored-by: Owl Bot * feat!: Actionable Error (#1244) * Create basic structure of GrpcDatastoreRpc and using it in DatastoreOptions * applying unary settings to all the unary methods * Configuring header provider for GrpcDatastoreRpc * fixing emulator tests to be able to run successfully with grpc now * ignoring one more test which will be fixed in actionable error implementation * Making HttpDatastoreRpc completely unused * Making GrpcDatastoreRpc implement AutoCloseable * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * incorporating feedbacks * pinging emulator after each test for debugging * Revert "pinging emulator after each test for debugging" This reverts commit 60ee45d27412aab8140fc7065010633cf59a0ae8. * Reapply "pinging emulator after each test for debugging" This reverts commit d42e3b995fe56ded8c5f080a262e8ea02c00c9d9. * more debugging * Constant ping to avoid flaky behaviour of /shutdown endpoint * fixing test * checking if emulator is running before sending a shutdown command * fix lint * implement helper method for localhost * fix header lint * moving emulator health check to src/test * fix lint * adding no extra headers * minor cleanup * Making DatastoreException extend BaseGrpcServiceException * Creating DatastoreException through ApiException and exposing methods to extract out domain, reason and metadata * Wrapping ApiException in DatastoreException before throwing it * adding clirr configuration * javadoc for getReason * deleting unused file * enabling tests which were ignore for actionable error implementation * added clirr comments * fix lint --------- Co-authored-by: Owl Bot * feat!: Making Datastore implement Closeable (#1246) * Making Datastore closeable and fixing integration test * Closing datastore in datastore test * fix lint * fix clirr config * test to verify if datastore client is getting closed after invoking close() method * Using a consistent port and reinitializing Datastore instance in @BeforeClass method * trying to fix connection reset problem * upgrading datastore emulator to fix DatastoreTest * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot * feat: enabling regapic by giving an option to user to use http (#1261) * feat: enabling regapic by giving an option to user to use http * enabling retry settings * fix lint * fix deps failure * fix deps failure * trying out ipv6 address resolution * Revert "trying out ipv6 address resolution" This reverts commit 1bf0e299b163df5ad7c510fdce6dc71d681801b5. * upgrading emulator * fix lint * downgrading to 2.0.2 to maintain java 8 compatibility * incorporating feedbacks * test retry settings while configuring DatastoreRpc instance * fix test * fix header * fix clirr check * fix lint * fix integration test * fix lint * incorporating feedback * test: Creating multi db rule to run tests multiple times against different named databases. (#1270) * integrating aggregation integration test with multidb rule * integrating multidb rule with ITDatastoreTest * addressing feedbacks * feat: remove `@BetaApi` annotations from get/setDatabaseId methods (#1277) Cherry pick of #1272 * feat!: mark interfaces as `@InternalExtensionOnly` (#1275) * feat!: mark interfaces as `@InternalExtensionOnly` * lint * refactor: rename internal class QueryAndReadOptions to QueryConfig (#1245) (#1283) (cherry picked from commit 41d43e852d07a9026ae5be2add860c1f6980c7d6) * deps: remove dependency on datastore-v1-proto-client module in google-cloud-datastore (#1281) * feat: use existing transport options API to set transport (#1276) * feat: use existing transport options API to set transport * lint * remove stale test * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot * deps: bump com.google.truth:truth from 1.1.5 to 1.4.0 (#1323) Bumps [com.google.truth:truth](https://togithub.com/google/truth) from 1.1.5 to 1.4.0.
Release notes

Sourced from com.google.truth:truth's releases.

1.4.0

In this release, our assertions on Java 8 types continue to move from the Truth8 class to the main Truth class. This change should not break compatibility for any supported JDK or Android version, even users who test under old versions of Android without API desugaring. Additionally, we will never break binary compatibility, though some users will have to make changes to their source code in order for it to compile against newer versions.

This release is likely to lead to more build failures than 1.3.0 did. However, those failures should be straightforward to fix.

Example build failure

Foo.java:152: error: reference to assertThat is ambiguous
    assertThat(repo.findFileWithName("foo")).isNull();
    ^
  both method assertThat(@org.jspecify.nullness.Nullable Path) in Truth8 and method assertThat(@org.jspecify.nullness.Nullable Path) in Truth match

Simplest upgrade strategy (if you can update all your code atomically in the same commit as the Truth upgrade)

In the same commit:

  1. Upgrade Truth to 1.4.0.
  2. Replace import static com.google.common.truth.Truth8.assertThat; with import static com.google.common.truth.Truth.assertThat;.
    • If you use Kotlin, replace import com.google.common.truth.Truth8.assertThat with import com.google.common.truth.Truth.assertThat.
  3. Replace import com.google.common.truth.Truth8; with import com.google.common.truth.Truth;.
    • again, similarly for Kotlin if needed
  4. Optionally replace remaining references to Truth8 with references to Truth.
    • For example, replace Truth8.assertThat(optional).isPresent() with Truth.assertThat(optional).isPresent().

If you're feeling lucky, you can try this one-liner for the code updates:

git grep -l Truth8 | xargs perl -pi -e 's/import static com.google.common.truth.Truth8.assertThat;/import static com.google.common.truth.Truth.assertThat;/g; s/import com.google.common.truth.Truth8.assertThat/import com.google.common.truth.Truth.assertThat/g; s/import com.google.common.truth.Truth8/import com.google.common.truth.Truth/g; s/\bTruth8[.]/Truth./g;'

In most cases, that can be further simplified to:

git grep -l Truth8 | xargs perl -pi -e 's/\bTruth8\b/Truth/g;'

After that process, it is possible that you'll still see build errors from ambiguous usages of assertThat static imports. If so, you can find a workaround in the section about overload ambiguity in the release notes for 1.3.0. Alternatively, you can wait to upgrade until after a future Truth release, which will eliminate the ambiguity by changing the signatures of some Truth.assertThat overloads.

Incremental upgrade strategy

If you have a very large repo or you have other reasons to prefer to upgrade incrementally, you can use the approach that we used inside Google. Roughly, that approach was:

  1. Make the optional changes discussed in the release notes for 1.3.0.
  2. For any remaining calls to Truth8.assertThat, change them to avoid static import.
    • That is, replace assertThat(optional).isPresent() with Truth8.assertThat(optional).isPresent().
  3. Upgrade Truth to 1.4.0.
  4. Optionally replace references to Truth8 with references to Truth (including restoring static imports if desired), as discussed in section about the simple upgrade strategy above.

... (truncated)

Commits
  • 2e8e488 Set version number for truth-parent to 1.4.0.
  • 1f81827 Copy Truth8.assertThat overloads for Path and OptionalLong to the main ...
  • 9be8e77 Copy remaining Truth8.assertThat overloads to the main Truth class—except...
  • b02a658 Migrate most usages of Truth8.assertThat to equivalent usages of `Truth.ass...
  • 0999369 Automated Code Change
  • 7c65fc6 Make it possible to write expect.that(optionalInt).isPresent(), `assertWith...
  • 87b371d Bump styfle/cancel-workflow-action from 0.12.0 to 0.12.1
  • 93b4d93 Add @since tags for the first batch of Java-8-related APIs.
  • 78d27dd Remove stale suppressions.
  • 7be930d Bump actions/cache from 3.3.3 to 4.0.0
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.google.truth:truth&package-manager=maven&previous-version=1.1.5&new-version=1.4.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
* deps: bump com.google.cloud:google-cloud-shared-config from 1.6.1 to 1.7.1 (#1324) Bumps [com.google.cloud:google-cloud-shared-config](https://togithub.com/googleapis/java-shared-config) from 1.6.1 to 1.7.1.
Release notes

Sourced from com.google.cloud:google-cloud-shared-config's releases.

v1.7.1

1.7.1 (2023-12-07)

Bug Fixes

  • Move release configs to native-image-shared-config (#725) (58ffb4e)

v1.7.0

1.7.0 (2023-12-04)

Features

  • Separate native-image-shared-config into its own module (#712) (567fecb)
Changelog

Sourced from com.google.cloud:google-cloud-shared-config's changelog.

1.7.1 (2023-12-07)

Bug Fixes

  • Move release configs to native-image-shared-config (#725) (58ffb4e)

1.7.0 (2023-12-04)

Features

  • Separate native-image-shared-config into its own module (#712) (567fecb)
Commits
  • f5f57c8 chore(main): release 1.7.1 (#727)
  • 9fcbe9e chore: update release-please.yml to include cloudbuild test yamls (#728)
  • c432bae chore(main): release 1.7.1-SNAPSHOT (#719)
  • 58ffb4e fix: move release configs to native-image-shared-config (#725)
  • 8d411bc ci: Update ci.yaml to introduce Java 21 unit testing (#1907) (#717)
  • 3382cee chore: add downstream check for native image tests in cloud build (#715)
  • b22a75a chore: update graalvm docker image for 1.7.0 release (#720)
  • 93824e5 chore(main): release 1.7.0 (#716)
  • 7435981 chore: remove docker validation check (#718)
  • 567fecb feat: separate native-image-shared-config into its own module (#712)
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.google.cloud:google-cloud-shared-config&package-manager=maven&previous-version=1.6.1&new-version=1.7.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
* deps: bump com.google.cloud:google-cloud-shared-dependencies from 3.19.0 to 3.24.0 (#1325) Bumps com.google.cloud:google-cloud-shared-dependencies from 3.19.0 to 3.24.0. [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.google.cloud:google-cloud-shared-dependencies&package-manager=maven&previous-version=3.19.0&new-version=3.24.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
* deps: bump org.apache.maven.plugins:maven-compiler-plugin from 3.11.0 to 3.12.1 (#1327) Bumps [org.apache.maven.plugins:maven-compiler-plugin](https://togithub.com/apache/maven-compiler-plugin) from 3.11.0 to 3.12.1.
Release notes

Sourced from org.apache.maven.plugins:maven-compiler-plugin's releases.

3.12.1

🐛 Bug Fixes

📦 Dependency updates

3.12.0

🚀 New features and improvements

🐛 Bug Fixes

📦 Dependency updates

👻 Maintenance

Commits
  • 736da68 [maven-release-plugin] prepare release maven-compiler-plugin-3.12.1
  • ef93f3d [MCOMPILER-568] Bump plexusCompilerVersion from 2.14.1 to 2.14.2 (#220)
  • eb7840c [MCOMPILER-567] - Fail to compile if the "generated-sources/annotations" does...
  • 2a7a73b [maven-release-plugin] prepare for next development iteration
  • c08b0fd [maven-release-plugin] prepare release maven-compiler-plugin-3.12.0
  • a1c5b13 [MCOMPILER-565] Allow project build by Maven 4
  • 4855773 Bump plexusCompilerVersion from 2.13.0 to 2.14.1
  • 1d05342 [MCOMPILER-562] Add property maven.compiler.outputDirectory to CompilerMojo (...
  • ea74978 [MCOMPILER-381] - Refactor incremental detection (#181)
  • fd37f09 [MCOMPILER-333] Cleanup generated source files (#214)
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.apache.maven.plugins:maven-compiler-plugin&package-manager=maven&previous-version=3.11.0&new-version=3.12.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
* test(deps): upgrade errorprone to 2.24.0 (#1271) (#1329) * test(deps): upgrade errorprone to 2.24.0 (#1271) * deps: upgrade errorprone to 2.24.0 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot * deps: bump com.google.errorprone:error_prone_core from 2.23.0 to 2.24.1 (#1326) Bumps [com.google.errorprone:error_prone_core](https://togithub.com/google/error-prone) from 2.23.0 to 2.24.1.
Release notes

Sourced from com.google.errorprone:error_prone_core's releases.

Error Prone 2.24.1

Changes:

Full Changelog: https://togithub.com/google/error-prone/compare/v2.24.0...v2.24.1

Error Prone 2.24.0

New checks:

Full Changelog: https://togithub.com/google/error-prone/compare/v2.23.0...v2.24.0

Commits
  • ecf7e10 Release Error Prone 2.24.1
  • 2bd7859 Add an assertion to try to help debug https://togithub.com/google/error-prone/i...
  • 58a9e80 Update a few checks (and a class of tests, with AbstractToString) to handle #...
  • fd21bc9 Reflow a comment that didn't appreciate being formatted in unknown commit
  • 63cf192 Update CanIgnoreReturnValueSuggester summary.
  • 5fa727a Actually test that hasExtraParameterForEnclosingInstance works.
  • 21c190a Document that javadoc shouldn't appear between annotations and the documented...
  • d272dfa Automated rollback of commit 654d1dbf1e6dd652cd6e8ca003643ddf02266ec2.
  • 654d1db Handle Joiner.on(...) in AbstractToString.
  • da7be27 Descend into VariableTrees when looking for variables to check.
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.google.errorprone:error_prone_core&package-manager=maven&previous-version=2.23.0&new-version=2.24.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
* feat: allow setting channel and credential providers in DatastoreOptions (#1299) * feat: allow setting channel and credential providers in DatastoreOptions * add additional validation and test * mark new fields as transient * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * update test * review feedback * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * review feedback * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot * chore: Update CODEOWNERS (#1297) (#1331) * chore: Update CODEOWNERS * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: Update .repo-metadata.json * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot * chore: run owlbot (#1330) * chore: run owlbot * update owlbot lock * deps: bump com.google.cloud:google-cloud-shared-dependencies from 3.24.0 to 3.25.0 (#1335) Bumps com.google.cloud:google-cloud-shared-dependencies from 3.24.0 to 3.25.0. [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.google.cloud:google-cloud-shared-dependencies&package-manager=maven&previous-version=3.24.0&new-version=3.25.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
* deps: bump com.google.truth:truth from 1.4.0 to 1.4.1 (#1341) Bumps [com.google.truth:truth](https://togithub.com/google/truth) from 1.4.0 to 1.4.1.
Release notes

Sourced from com.google.truth:truth's releases.

1.4.1

This release deprecates Truth8.

All its methods have become available on the main Truth class. In most cases, you can migrate your whole project mechanically: git grep -l Truth8 | xargs perl -pi -e 's/\bTruth8\b/Truth/g;'

While we do not plan to delete Truth8, we recommend migrating off it, at least if you static import assertThat: If you do not migrate, such static imports will become ambiguous in Truth 1.4.2, breaking your build.

Commits
  • a920d7d Set version number for truth-parent to 1.4.1.
  • 3406074 Document more about how and why to migrate off Truth8.
  • 2be0061 Update docs to reflect that the Java 8 assertions have "moved" to the main `T...
  • See full diff in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.google.truth:truth&package-manager=maven&previous-version=1.4.0&new-version=1.4.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
* deps: bump com.google.errorprone:error_prone_core from 2.24.1 to 2.25.0 (#1340) Bumps [com.google.errorprone:error_prone_core](https://togithub.com/google/error-prone) from 2.24.1 to 2.25.0.
Release notes

Sourced from com.google.errorprone:error_prone_core's releases.

Error Prone 2.25.0

New checks:

Closed issues: #4195, #4224, #4228, #4248, #4249, #4251

Full Changelog: https://togithub.com/google/error-prone/compare/v2.24.1...v2.25.0

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.google.errorprone:error_prone_core&package-manager=maven&previous-version=2.24.1&new-version=2.25.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
* revert: "test: Creating multi db rule to run tests multiple times agai… (#1346) * Revert "test: Creating multi db rule to run tests multiple times against different named databases. (#1270)" This reverts commit 780c9f40f1ae04d0ec919d203bf256e3cff8fcc1. * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot * deps: bump com.google.truth:truth from 1.4.1 to 1.4.2 (#1354) Bumps [com.google.truth:truth](https://togithub.com/google/truth) from 1.4.1 to 1.4.2.
Release notes

Sourced from com.google.truth:truth's releases.

1.4.2

This release is the final step of copying all our methods from Truth8 to Truth. If you have not already migrated your usages from Truth8 to Truth, you may see build errors:

OptionalSubjectTest.java:39: error: reference to assertThat is ambiguous
    assertThat(Optional.of("foo")).isPresent();
    ^
  both method assertThat(@org.checkerframework.checker.nullness.qual.Nullable Optional<?>) in Truth8 and method assertThat(@org.checkerframework.checker.nullness.qual.Nullable Optional<?>) in Truth match

In most cases, you can migrate your whole project mechanically: git grep -l Truth8 | xargs perl -pi -e 's/\bTruth8\b/Truth/g;'. (You can make that change before upgrading to Truth 1.4.2 or as part of the same commit.)

If you instead need to migrate your project incrementally (for example, because it is very large), you may want to upgrade your version of Truth incrementally, too, following our instructions for 1.3.0 and 1.4.0.

For help

Please feel welcome to open an issue to report problems or request help.

Changelog

  • Removed temporary type parameters from Truth.assertThat(Stream) and Truth.assertThat(Optional). This can create build errors, which you can fix by replacing all your references to Truth8 with references to Truth. (45782bd0e)
Commits
  • 0ca7ef0 Set version number for truth-parent to 1.4.2.
  • e3b4354 Enable a few more Guava Primitives tests for J2KT
  • ae78f4a Bump actions/setup-java from 4.0.0 to 4.1.0
  • 996a844 Remove more copies of a workaround for an ancient Android bug.
  • a43223e Suppress TruthSelfEquals violations in Truth.
  • 559d636 Suppress NullableOptional, as we already do in, e.g., `Truth.assertThat(Opt...
  • 3efe353 Automated Code Change
  • 5efd53f Change assertThat(array) to allow arrays of non-nullable elements
  • bbd8d12 Bump com.google.errorprone:error_prone_annotations from 2.24.1 to 2.25.0
  • c243961 Remove @J2ktIncompatible from StringSubject#matches
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.google.truth:truth&package-manager=maven&previous-version=1.4.1&new-version=1.4.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
* deps: bump com.google.cloud:google-cloud-shared-dependencies from 3.25.0 to 3.27.0 (#1353) Bumps com.google.cloud:google-cloud-shared-dependencies fr…
1 parent c71b786 commit a296d43

83 files changed

Lines changed: 13945 additions & 230 deletions

File tree

Some content is hidden

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

‎.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: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ updates:
1717
# If a security vulnerability comes in, we will be notified about
1818
# it via template in the synthtool repository.
1919
ignore:
20-
- dependency-name: "*"
21-
20+
- dependency-name: "*"
2221
# rules for the `grpc-experimental` branch
2322
- package-ecosystem: maven
2423
directory: "/"

‎.github/sync-repo-settings.yaml‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -157,22 +157,6 @@ branchProtectionRules:
157157
- 'Kokoro - Test: Java GraalVM Native Image'
158158
- 'Kokoro - Test: Java 17 GraalVM Native Image'
159159
- javadoc
160-
- pattern: grpc-experimental
161-
isAdminEnforced: true
162-
requiredApprovingReviewCount: 1
163-
requiresCodeOwnerReviews: true
164-
requiresStrictStatusChecks: false
165-
requiredStatusCheckContexts:
166-
- dependencies (17)
167-
- lint
168-
- clirr
169-
- units (8)
170-
- units (11)
171-
- 'Kokoro - Test: Integration'
172-
- cla/google
173-
- 'Kokoro - Test: Java GraalVM Native Image'
174-
- 'Kokoro - Test: Java 17 GraalVM Native Image'
175-
- javadoc
176160
- pattern: 2.19.x
177161
isAdminEnforced: true
178162
requiredApprovingReviewCount: 1

‎.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
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
xml version='1.0' encoding='UTF-8'?>
2+
<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">
3+
<modelVersion>4.0.0modelVersion>
4+
<groupId>com.google.cloudgroupId>
5+
<artifactId>google-cloud-datastore-utilsartifactId>
6+
<version>2.27.3-SNAPSHOTversion>
7+
<packaging>jarpackaging>
8+
<name>Google Cloud Datastore Utilitiesname>
9+
<url>https://github.com/googleapis/java-datastoreurl>
10+
<description>
11+
Java datastore client utility library.
12+
description>
13+
<parent>
14+
<groupId>com.google.cloudgroupId>
15+
<artifactId>google-cloud-datastore-parentartifactId>
16+
<version>2.27.3-SNAPSHOTversion>
17+
parent>
18+
<properties>
19+
<site.installationModule>google-cloud-datastore-utilssite.installationModule>
20+
properties>
21+
<dependencies>
22+
<dependency>
23+
<groupId>com.google.api-clientgroupId>
24+
<artifactId>google-api-clientartifactId>
25+
dependency>
26+
<dependency>
27+
<groupId>com.google.http-clientgroupId>
28+
<artifactId>google-http-client-protobufartifactId>
29+
dependency>
30+
<dependency>
31+
<groupId>com.google.http-clientgroupId>
32+
<artifactId>google-http-client-gsonartifactId>
33+
dependency>
34+
<dependency>
35+
<groupId>com.google.api.grpcgroupId>
36+
<artifactId>proto-google-cloud-datastore-v1artifactId>
37+
dependency>
38+
<dependency>
39+
<groupId>com.google.apigroupId>
40+
<artifactId>api-commonartifactId>
41+
dependency>
42+
<dependency>
43+
<groupId>com.google.protobufgroupId>
44+
<artifactId>protobuf-javaartifactId>
45+
dependency>
46+
<dependency>
47+
<groupId>com.google.guavagroupId>
48+
<artifactId>guavaartifactId>
49+
dependency>
50+
<dependency>
51+
<groupId>com.google.api.grpcgroupId>
52+
<artifactId>proto-google-common-protosartifactId>
53+
dependency>
54+
<dependency>
55+
<groupId>com.google.http-clientgroupId>
56+
<artifactId>google-http-clientartifactId>
57+
dependency>
58+
<dependency>
59+
<groupId>com.google.http-clientgroupId>
60+
<artifactId>google-http-client-jackson2artifactId>
61+
dependency>
62+
<dependency>
63+
<groupId>com.google.oauth-clientgroupId>
64+
<artifactId>google-oauth-clientartifactId>
65+
dependency>
66+
<dependency>
67+
<groupId>com.google.code.findbugsgroupId>
68+
<artifactId>jsr305artifactId>
69+
dependency>
70+
71+
<dependency>
72+
<groupId>junitgroupId>
73+
<artifactId>junitartifactId>
74+
<scope>testscope>
75+
dependency>
76+
<dependency>
77+
<groupId>com.google.truthgroupId>
78+
<artifactId>truthartifactId>
79+
<version>1.4.2version>
80+
<scope>testscope>
81+
<exclusions>
82+
<exclusion>
83+
<groupId>org.checkerframeworkgroupId>
84+
<artifactId>checker-qualartifactId>
85+
exclusion>
86+
exclusions>
87+
dependency>
88+
dependencies>
89+
90+
<build>
91+
<plugins>
92+
<plugin>
93+
<groupId>org.apache.maven.pluginsgroupId>
94+
<artifactId>maven-surefire-pluginartifactId>
95+
<configuration>
96+
<argLine>-Xmx2048margLine>
97+
configuration>
98+
plugin>
99+
plugins>
100+
build>
101+
102+
<profiles>
103+
<profile>
104+
<id>nativeid>
105+
<properties>
106+
107+
<skipTests>trueskipTests>
108+
properties>
109+
profile>
110+
profiles>
111+
project>
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
/*
2+
* Copyright 2024 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.google.datastore.utils;
17+
18+
import com.google.datastore.v1.*;
19+
import com.google.rpc.Code;
20+
import java.io.IOException;
21+
import java.io.InputStream;
22+
23+
/**
24+
* Provides access to Cloud Datastore.
25+
*
26+
*

This class is thread-safe.

27+
*/
28+
public class Datastore {
29+
30+
final RemoteRpc remoteRpc;
31+
32+
Datastore(RemoteRpc remoteRpc) {
33+
this.remoteRpc = remoteRpc;
34+
}
35+
36+
/** Reset the RPC count. */
37+
public void resetRpcCount() {
38+
remoteRpc.resetRpcCount();
39+
}
40+
41+
/**
42+
* Returns the number of RPC calls made since the client was created or {@link #resetRpcCount} was
43+
* called.
44+
*/
45+
public int getRpcCount() {
46+
return remoteRpc.getRpcCount();
47+
}
48+
49+
private com.google.datastore.utils.DatastoreException invalidResponseException(
50+
String method, IOException exception) {
51+
return RemoteRpc.makeException(
52+
remoteRpc.getUrl(), method, Code.UNAVAILABLE, "Invalid response", exception);
53+
}
54+
55+
public AllocateIdsResponse allocateIds(AllocateIdsRequest request)
56+
throws com.google.datastore.utils.DatastoreException {
57+
try (InputStream is =
58+
remoteRpc.call("allocateIds", request, request.getProjectId(), request.getDatabaseId())) {
59+
return AllocateIdsResponse.parseFrom(is);
60+
} catch (IOException exception) {
61+
throw invalidResponseException("allocateIds", exception);
62+
}
63+
}
64+
65+
public BeginTransactionResponse beginTransaction(BeginTransactionRequest request)
66+
throws com.google.datastore.utils.DatastoreException {
67+
try (InputStream is =
68+
remoteRpc.call(
69+
"beginTransaction", request, request.getProjectId(), request.getDatabaseId())) {
70+
return BeginTransactionResponse.parseFrom(is);
71+
} catch (IOException exception) {
72+
throw invalidResponseException("beginTransaction", exception);
73+
}
74+
}
75+
76+
public CommitResponse commit(CommitRequest request)
77+
throws com.google.datastore.utils.DatastoreException {
78+
try (InputStream is =
79+
remoteRpc.call("commit", request, request.getProjectId(), request.getDatabaseId())) {
80+
return CommitResponse.parseFrom(is);
81+
} catch (IOException exception) {
82+
throw invalidResponseException("commit", exception);
83+
}
84+
}
85+
86+
public LookupResponse lookup(LookupRequest request)
87+
throws com.google.datastore.utils.DatastoreException {
88+
try (InputStream is =
89+
remoteRpc.call("lookup", request, request.getProjectId(), request.getDatabaseId())) {
90+
return LookupResponse.parseFrom(is);
91+
} catch (IOException exception) {
92+
throw invalidResponseException("lookup", exception);
93+
}
94+
}
95+
96+
public ReserveIdsResponse reserveIds(ReserveIdsRequest request)
97+
throws com.google.datastore.utils.DatastoreException {
98+
try (InputStream is =
99+
remoteRpc.call("reserveIds", request, request.getProjectId(), request.getDatabaseId())) {
100+
return ReserveIdsResponse.parseFrom(is);
101+
} catch (IOException exception) {
102+
throw invalidResponseException("reserveIds", exception);
103+
}
104+
}
105+
106+
public RollbackResponse rollback(RollbackRequest request)
107+
throws com.google.datastore.utils.DatastoreException {
108+
try (InputStream is =
109+
remoteRpc.call("rollback", request, request.getProjectId(), request.getDatabaseId())) {
110+
return RollbackResponse.parseFrom(is);
111+
} catch (IOException exception) {
112+
throw invalidResponseException("rollback", exception);
113+
}
114+
}
115+
116+
public RunQueryResponse runQuery(RunQueryRequest request)
117+
throws com.google.datastore.utils.DatastoreException {
118+
try (InputStream is =
119+
remoteRpc.call("runQuery", request, request.getProjectId(), request.getDatabaseId())) {
120+
return RunQueryResponse.parseFrom(is);
121+
} catch (IOException exception) {
122+
throw invalidResponseException("runQuery", exception);
123+
}
124+
}
125+
126+
public RunAggregationQueryResponse runAggregationQuery(RunAggregationQueryRequest request)
127+
throws DatastoreException {
128+
try (InputStream is =
129+
remoteRpc.call(
130+
"runAggregationQuery", request, request.getProjectId(), request.getDatabaseId())) {
131+
return RunAggregationQueryResponse.parseFrom(is);
132+
} catch (IOException exception) {
133+
throw invalidResponseException("runAggregationQuery", exception);
134+
}
135+
}
136+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright 2024 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.google.datastore.utils;
17+
18+
import com.google.rpc.Code;
19+
20+
/** Indicates an error in a {@link Datastore} call. */
21+
public class DatastoreException extends Exception {
22+
private final String methodName;
23+
private final Code code;
24+
25+
public DatastoreException(String methodName, Code code, String message, Throwable cause) {
26+
super(message, cause);
27+
this.methodName = methodName;
28+
this.code = code;
29+
}
30+
31+
/**
32+
* @return the canonical error code
33+
*/
34+
public Code getCode() {
35+
return code;
36+
}
37+
38+
/**
39+
* @return the datastore method name
40+
*/
41+
public String getMethodName() {
42+
return methodName;
43+
}
44+
45+
@Override
46+
public String toString() {
47+
return String.format("%s, code=%s", super.toString(), code);
48+
}
49+
}

0 commit comments

Comments
 (0)