quickwit-oss/quickwit

Refactor Source building

开放

#1,064 创建于 2022年1月11日

 (4 条评论) (0 个反应) (0 位负责人)Rust (581 个派生)github user discovery
enhancementhelp wanted

仓库指标

星标
 (11,537 个星标)
PR 合并指标
 (平均合并 5天 18小时) (30 天内合并 41 个 PR)

描述

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.

贡献者指南