| 33 | } |
| 34 | |
| 35 | func newEventuallyConsistentRing(cfg ring.Config, name, key string, reg prometheus.Registerer) (*ring.Ring, error) { |
| 36 | codec := ring.GetCodec() |
| 37 | // Suffix all client names with "-ring" to denote this kv client is used by the ring |
| 38 | store, err := kv.NewClient( |
| 39 | cfg.KVStore, |
| 40 | codec, |
| 41 | kv.RegistererWithKVName(reg, name+"-ring"), |
| 42 | log.Logger, |
| 43 | ) |
| 44 | if err != nil { |
| 45 | return nil, err |
| 46 | } |
| 47 | |
| 48 | return ring.NewWithStoreClientAndStrategy(cfg, name, key, store, &EventuallyConsistentStrategy{}, reg, log.Logger) |
| 49 | } |
| 50 | |
| 51 | // EventuallyConsistentStrategy represents a repl strategy with a consistency of 1 on read and |
| 52 | // write. Note this is NOT strongly consistent! It is _eventually_ consistent :) |