pjfanning opened a new pull request, #927:
URL: https://github.com/apache/pekko-grpc/pull/927

   ### Motivation
   Pekko gRPC clients always sent uncompressed requests. Neither backend had a 
setting to enable compression (#923).
   
   **Depends on #926** (deflate support), which this branch is stacked on. 
Review only the last commit, "Support client-side request compression"; I will 
rebase once #926 is merged.
   
   ### Modification
   - New `compression` client setting: 
`GrpcClientSettings.withCompression(...)` and 
`pekko.grpc.client."*".compression`.
     - Values are `gzip`, `deflate`, or `identity`/empty for no compression, 
which is the default.
     - Unsupported names are rejected when the settings are created.
     - A hand-assembled `Config` without the key means no compression, as for 
`max-inbound-message-size`.
   - pekko-http backend: the request writer uses the configured codec, 
replacing the hard-coded `Identity`.
   - netty backend:
     - The configured compression is set on the client's `CallOptions` 
(`NettyClientUtils.callOptions`), which the generated Scala and Java clients 
use.
     - grpc-java ships only gzip, so the channel gets a `CompressorRegistry` 
with gzip, identity and a deflate `Codec`.
     - The channel's decompressor registry, and so the `grpc-accept-encoding` 
it advertises, is unchanged.
   - A new "Request compression" section in `client/configuration.md`, with 
config and Scala/Java examples.
   
   Compression per call (on the request builders) is left for later.
   
   ### Result
   Clients can compress requests with gzip or deflate, on both the netty and 
the pekko-http backend.
   
   ### Tests
   - New `ClientCompressionSpec`, run with the netty and the pekko-http 
backend. For default, gzip and deflate clients, with unary and streamed 
requests, it checks the `grpc-encoding` header and the compressed flag of the 
first frame the server receives, and that the server decodes the request.
   - Directional: with the backend changes reverted (setting only), all 8 
compression tests fail, and the 2 default tests still pass.
   - New `GrpcClientSettingsSpec` tests: the default, setting the value, 
`identity` as none, rejecting an unknown name, reading from config, and a 
`Config` without the key.
   - `sbt runtime/test`: 205 passed
   - `sbt interop-tests/test`: 266 passed
   - `sbt runtime/mimaReportBinaryIssues`: passed
   - `sbt headerCheckAll`, `sbt docs/paradox`: passed
   - `scalafmt --mode diff-ref=upstream/main` run
   
   ### References
   Fixes #923. Depends on #926
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to