grpc / grpc/grpc-java

Investigate bulk metadata functions

Offen
#5,596 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Java
Sterne
12.1k
Forks
4k
Ø Merge
2 T. 17 Std.
Gemergte PRs (30 T.)
37

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start by reviewing the existing Metadata API, including Metadata.Key and BinaryMarshaller, and compare the four proposed walk options against middleware scanning and duplicate-key use cases. Done means reaching a decision on the bulk metadata API design and documenting the selected behavior.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
api
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.