grpc / grpc/grpc-java

Investigate bulk metadata functions

Aperta
#5,596 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
12.1k
Fork
4k
Merge medio
2g 17h
PR unite (30g)
37

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
api
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.