Skip to content

feat(storage): add support for DirectPath over Interconnect - #13904

Draft
nidhiii-27 wants to merge 3 commits into
mainfrom
dp-over-gci
Draft

feat(storage): add support for DirectPath over Interconnect#13904
nidhiii-27 wants to merge 3 commits into
mainfrom
dp-over-gci

Conversation

@nidhiii-27

Copy link
Copy Markdown
Contributor

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for DirectPath xDS over Interconnect (on-premise xDS name resolution) across google-cloud-storage and gax-grpc. It adds the attemptDirectPathXdsOverInterconnect configuration, bypasses GCE environment checks when enabled, appends ?force-xds to the target URI, and updates endpoint validation to support custom URI schemes. Feedback on the changes includes restoring the accidentally removed getExecutor() method in InstantiatingGrpcChannelProvider, replacing fragile string equality checks for endpoint translation with a more robust replacement approach in GrpcStorageOptions, and simplifying redundant String.format calls in endpoint validation.

I am having trouble creating individual review comments. Click here to see my feedback.

sdk-platform-java/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java (268)

high

The getExecutor() method was accidentally removed from InstantiatingGrpcChannelProvider. Since this class implements TransportChannelProvider, removing this method will cause it to fallback to the interface's default implementation (which likely returns null), breaking the ability to retrieve the configured executor. Please restore this method.

  @Nullable
  @Override
  public Executor getExecutor() {
    return executor;
  }

java-storage/google-cloud-storage/src/main/java/com/google/cloud/storage/GrpcStorageOptions.java (235-241)

medium

The current string equality checks for endpoint are fragile. If the host is configured with a port (e.g., storage.googleapis.com:443), a trailing slash, or other variations, the translation to storage.direct.googleapis.com will be bypassed. Using String.replace is much more robust, simpler, and handles all these cases seamlessly.

    if (attemptDirectPathXdsOverInterconnect && endpoint != null) {
      endpoint = endpoint.replace("storage.googleapis.com", "storage.direct.googleapis.com");
    }

sdk-platform-java/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java (1494-1512)

medium

The String.format calls with no format arguments are redundant and can be simplified to direct string literals for better performance and readability. Avoid adding defensive null checks for endpoint as it is guaranteed to be non-null by design.

    if (endpoint.contains(":///")) {
      try {
        java.net.URI.create(endpoint);
        return;
      } catch (IllegalArgumentException e) {
        throw new IllegalArgumentException("invalid endpoint URI: " + endpoint, e);
      }
    }
    int colon = endpoint.lastIndexOf(':');
    if (colon < 0) {
      throw new IllegalArgumentException("invalid endpoint, expecting \"<host>:<port>\"");
    }
    try {
      Integer.parseInt(endpoint.substring(colon + 1));
    } catch (NumberFormatException e) {
      throw new IllegalArgumentException("invalid endpoint, expecting \"<host>:<port>\"", e);
    }
References
  1. Avoid adding defensive null checks for values that are guaranteed to be non-null by design, as this can hide invariant breaks.

@nidhiii-27 nidhiii-27 closed this Jul 27, 2026
@nidhiii-27 nidhiii-27 reopened this Jul 28, 2026
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed for 'gapic-generator-java-root'

Failed conditions
22.6% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed for 'gapic-generator-java-root'

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant