quickwit-oss/quickwit

Refactor Source building

Aperta

#1064 aperta il 11 gen 2022

 (4 commenti) (0 reazioni) (0 assegnatari)Rust (581 fork)github user discovery
enhancementhelp wanted

Metriche repository

Star
 (11.537 stelle)
Metriche merge PR
 (Merge medio 5g 18h) (41 PR mergiate in 30 g)

Descrizione

In #1058, we did one step from (dynamic factory + json) to a static enum world in order to have source type specific source params validation.

We are now half-way between two worlds.

Solution 1

Just go full enum. The factory is a function of the enum. Pros: Very simple Cons: Does not separate the concern super well.

Note: If we go for that route, source_type() should return an enum too.

Solution 2

Use a SourceParams trait that can build a Source type (does the job of the factory) and do dark magic, like what @fmassot did for the IndexConfig deserialization.

Guida contributor