Improve usability of multi-valued ASCII keys
- Ngôn ngữ chính
- Java
- Star
- 12.1k
- Fork
- 4k
- Merge trung bình
- 2 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 37
Mô tả
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.
Hướng dẫn đóng góp
Hướng nghiên cứu
Issue không nêu tên tệp, test hoặc entry point cụ thể nào. Hãy bắt đầu bằng cách xác định Metadata.Key và các API key ASCII và binary hiện có, sau đó so sánh cách chúng xử lý metadata có nhiều giá trị. Được xem là hoàn tất khi có một thiết kế API đã được thống nhất, với phạm vi bao phủ cho các giá trị được tách riêng và kết hợp tương đương, nhưng issue không xác định cách tiếp cận cuối cùng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- grpc, java
- Lĩnh vực
- api, backend-api-design
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 25/100