MCPcopy
hub / github.com/grafana/dskit / NewClient

Function NewClient

kv/client.go:129–135  ·  view source on GitHub ↗

NewClient creates a new Client (consul, etcd or inmemory) 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

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

Callers 3

NewFunction · 0.92
NewLifecyclerFunction · 0.92

Calls 1

createClientFunction · 0.85

Tested by 1