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)
| 123 | // NewClient creates a new Client based on the config, |
| 124 | // encodes and decodes data for storage using the codec. |
| 125 | func 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 | |
| 133 | func createClient(backend string, prefix string, cfg StoreConfig, codec codec.Codec, role role, reg prometheus.Registerer, logger log.Logger) (Client, error) { |
| 134 | var client Client |