MCPcopy Index your code
hub / github.com/cortexproject/cortex / New

Function New

pkg/ring/ring.go:229–243  ·  view source on GitHub ↗

New creates a new Ring. Being a service, Ring needs to be started to do anything.

(cfg Config, name, key string, logger log.Logger, reg prometheus.Registerer)

Source from the content-addressed store, hash-verified

227
228// New creates a new Ring. Being a service, Ring needs to be started to do anything.
229func New(cfg Config, name, key string, logger log.Logger, reg prometheus.Registerer) (*Ring, error) {
230 codec := GetCodec()
231 // Suffix all client names with "-ring" to denote this kv client is used by the ring
232 store, err := kv.NewClient(
233 cfg.KVStore,
234 codec,
235 kv.RegistererWithKVName(reg, name+"-ring"),
236 logger,
237 )
238 if err != nil {
239 return nil, err
240 }
241
242 return NewWithStoreClientAndStrategy(cfg, name, key, store, NewDefaultReplicationStrategy(), reg, logger)
243}
244
245func NewWithStoreClientAndStrategy(cfg Config, name, key string, store kv.Client, strategy ReplicationStrategy, reg prometheus.Registerer, logger log.Logger) (*Ring, error) {
246 if cfg.ReplicationFactor <= 0 {

Callers 15

prepareFunction · 0.92
NewFunction · 0.92
prepareFunction · 0.92
initRingMethod · 0.92
startingMethod · 0.92
startingMethod · 0.92
TestRingUpdatesFunction · 0.70

Calls 5

NewClientFunction · 0.92
RegistererWithKVNameFunction · 0.92
GetCodecFunction · 0.85