Skip to content
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

Introduce method for configuring response unmarshaller for specified RPC #2501

Open
frankyn opened this issue Feb 24, 2024 · 0 comments
Open
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@frankyn
Copy link
Member

frankyn commented Feb 24, 2024

Is your feature request related to a problem? Please describe.
In Storage SDK (java-storage); we are looking at introducing a new zero copy response marshaler for ReadObject request. It currently can only be configured by recreating the callable which replicates code in the GAPIC generated client library. Our main concern is that it deviates from potential future improvements which would need to be ported over to one-off callable implementations.

// Redacted from constructor where this is being created in the prototype linked below.
serverStreamingCallable =
          new GrpcStorageCallableFactory()
              .createServerStreamingCallable(
                  readObjectTransportSettings,
                  storageClient.getSettings().readObjectSettings(),
                  ClientContext.create(storageClient.getSettings()));

// ....

static final MethodDescriptor<ReadObjectRequest, ReadObjectResponse> readObjectMethodDescriptor =
      MethodDescriptor.<ReadObjectRequest, ReadObjectResponse>newBuilder()
          .setType(MethodDescriptor.MethodType.SERVER_STREAMING)
          .setFullMethodName("google.storage.v2.Storage/ReadObject")
          .setRequestMarshaller(ProtoUtils.marshaller(ReadObjectRequest.getDefaultInstance()))
          .setResponseMarshaller(getObjectMediaResponseMarshaller)
          .build();

  GrpcCallSettings<ReadObjectRequest, ReadObjectResponse> readObjectTransportSettings =
      GrpcCallSettings.<ReadObjectRequest, ReadObjectResponse>newBuilder()
          .setMethodDescriptor(readObjectMethodDescriptor)
          .setParamsExtractor(
              request -> {
                RequestParamsBuilder builder = RequestParamsBuilder.create();
                builder.add(request.getBucket(), "bucket", PathTemplate.create("{bucket=**}"));
                return builder.build();
              })
          .build();

Describe the solution you'd like
Having a way to configure response unmarshaler for a given RPC in an existing GAPIC client would remove having to maintain this additional code. We currently only need it for ReadObject requests but there will be another RPC soon that will most likely also require this unmarshaler as well.

Describe alternatives you've considered
For now we are implementing it this way to unblock zero copy unmarshaler implementation.

Additional context

@burkedavison burkedavison added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Mar 5, 2024
@blakeli0 blakeli0 added the priority: p2 Moderately-important priority. Fix may not be included in next release. label Mar 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

4 participants