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

Function NewClient

pkg/ring/kv/client.go:125–131  ·  view source on GitHub ↗

NewClient creates a new Client based on the config, encodes and decodes data for storage using the codec.

(cfg Config, codec codec.Codec, reg prometheus.Registerer, logger log.Logger)

Source from the content-addressed store, hash-verified

123// NewClient creates a new Client based on the config,
124// encodes and decodes data for storage using the codec.
125func NewClient(cfg Config, codec codec.Codec, reg prometheus.Registerer, logger log.Logger) (Client, error) {
126 if cfg.Mock != nil {
127 return cfg.Mock, nil
128 }
129
130 return createClient(cfg.Store, cfg.Prefix, cfg.StoreConfig, codec, Primary, reg, logger)
131}
132
133func createClient(backend string, prefix string, cfg StoreConfig, codec codec.Codec, role role, reg prometheus.Registerer, logger log.Logger) (Client, error) {
134 var client Client

Callers 9

setupEtcdFunction · 0.92
setupConsulFunction · 0.92
NewFunction · 0.92
NewLifecyclerFunction · 0.92
NewStoreGatewayFunction · 0.92
NewHATrackerFunction · 0.92
newRulerFunction · 0.92

Calls 1

createClientFunction · 0.85

Tested by 2

setupEtcdFunction · 0.74
setupConsulFunction · 0.74