hyperium / tonic

A native gRPC client & server implementation with async/await support.
https://docs.rs/tonic
MIT License
9.32k stars 954 forks source link

Make compression encoding configuration more malleable #1757

Closed djc closed 1 week ago

djc commented 1 week ago

Motivation

Alternative approach to #1727, enable callers to influence compression encoding priority. Also changes the default order so that Zstd comes before Gzip if enabled (which happens when the zstd Cargo feature is explicitly enabled).

Solution

Implement an internal array while avoiding making changes to existing public API.

cc @CapCap

djc commented 1 week ago

Not completely sure whether this actually solves the original issue described in #1727. IMO it would be better if the config wrapper allowed overwriting the EnabledCompressionEncodings instead of appending to it.