NewInMemoryClient creates an Etcd Client implementation that uses an in-memory version of the underlying Etcd client.
(codec codec.Codec, logger log.Logger)
| 23 | // NewInMemoryClient creates an Etcd Client implementation that uses an in-memory |
| 24 | // version of the underlying Etcd client. |
| 25 | func NewInMemoryClient(codec codec.Codec, logger log.Logger) (*Client, io.Closer) { |
| 26 | // Make sure to set default values for the config including number of retries, |
| 27 | // otherwise the client won't even attempt a CAS operation |
| 28 | cfg := Config{} |
| 29 | flagext.DefaultValues(&cfg) |
| 30 | |
| 31 | kv := newMockKV() |
| 32 | client := &Client{ |
| 33 | cfg: cfg, |
| 34 | codec: codec, |
| 35 | cli: kv, |
| 36 | logger: logger, |
| 37 | } |
| 38 | |
| 39 | return client, kv |
| 40 | } |
| 41 | |
| 42 | // newMockKV creates an in-memory implementation of an etcd client |
| 43 | func newMockKV() *mockKV { |