grpc / grpc/grpc-java

Investigate bulk metadata functions

Open
#5,596 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
12.1k
Forks
4k
Avg merge
2d 17h
Merged PRs (30d)
37

Description

Metadata provides limited public APIs for interaction, typically requiring a Metadata.Key to do any reads or writes. This is useful to an application, which may know the key name and marshaller ahead of time, but not so much for middle-ware which may need to scan for keys. As an example, a middle-ware that looks for metadata prefixes and builds a custom Key depending on the suffix of the key name has trouble with the existing Metadata API. It requires multiple iterations through the metadata, and up to O(n^2) ops when trying to extract values with duplicate key names.

Metadata is also mutable, and does not want to expose internals, as they may yet change. I am proposing some experimental APIs here to address the bulk metadata functions use case:

Option 1:

```
// For each value in the MD which matches the key prefix, return the parsed value
List walk(String keyPrefix, Metadata.BinaryMarshaller marshaller) {}
```

Option 2:

```
void walk(Function> nameToKeyFn, Consumer valueConsumer) {}
```

Option 3:
```
// For each value in the MD which matches the key prefix, return the parsed value
void walk(String keyPrefix, Metadata.BinaryMarshaller marshaller, BiConsumer> nameToKeyFn, BiConsumer

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.