Improve usability of multi-valued ASCII keys
- Dominant language
- Java
- Stars
- 12.1k
- Forks
- 4k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 37
Description
For keys like Grpc-Accept-Encoding ["gzip", "deflate"] is semantically equivalent to ["gzip,deflate"]. We should have a utility or tweak our API to make encourage applications to handle multi-valued metadata correctly.
A separate but related issue is that users of Keys have to be aware of whether the key is for ascii or binary, since you are likely to use the get() methods differently between the two. It might be good to have some "meta" key that could behave identically between the two.
For example, we could have something like:
``` java
public interface MultivalueMarshaller {
List splitValues(C combined);
C combineValues(List separate);
}
```
Which could be used as a special key:
```
new Metadata.Key.of("Grpc-Accept-Encoding", new MultivalueAcceptEncoding(), new AcceptEncodingMarshaller());
```
The key would always act as if there was only one value, and would typically be used with `Metadata.get()`.
I'm not 100% sold on the example solution, because it seems we keep adding more and more layers.
Contributor guide
Assessment
This issue has not been assessed yet.