MCPcopy Create free account
hub / github.com/cortexproject/cortex / buildMultiClient

Function buildMultiClient

pkg/ring/kv/client.go:192–219  ·  view source on GitHub ↗
(cfg StoreConfig, codec codec.Codec, reg prometheus.Registerer, logger log.Logger)

Source from the content-addressed store, hash-verified

190}
191
192func buildMultiClient(cfg StoreConfig, codec codec.Codec, reg prometheus.Registerer, logger log.Logger) (Client, error) {
193 if cfg.Multi.Primary == "" || cfg.Multi.Secondary == "" {
194 return nil, fmt.Errorf("primary or secondary store not set")
195 }
196 if cfg.Multi.Primary == "multi" || cfg.Multi.Secondary == "multi" {
197 return nil, fmt.Errorf("primary and secondary stores cannot be multi-stores")
198 }
199 if cfg.Multi.Primary == cfg.Multi.Secondary {
200 return nil, fmt.Errorf("primary and secondary stores must be different")
201 }
202
203 primary, err := createClient(cfg.Multi.Primary, "", cfg, codec, Primary, reg, logger)
204 if err != nil {
205 return nil, err
206 }
207
208 secondary, err := createClient(cfg.Multi.Secondary, "", cfg, codec, Secondary, reg, logger)
209 if err != nil {
210 return nil, err
211 }
212
213 clients := []kvclient{
214 {client: primary, name: cfg.Multi.Primary},
215 {client: secondary, name: cfg.Multi.Secondary},
216 }
217
218 return NewMultiClient(cfg.Multi, clients, logger, reg), nil
219}

Callers 1

createClientFunction · 0.85

Calls 2

createClientFunction · 0.85
NewMultiClientFunction · 0.85

Tested by

no test coverage detected