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

Function NewInMemoryClient

kv/etcd/mock.go:25–40  ·  view source on GitHub ↗

NewInMemoryClient creates an Etcd Client implementation that uses an in-memory version of the underlying Etcd client.

(codec codec.Codec, logger log.Logger)

Source from the content-addressed store, hash-verified

23// NewInMemoryClient creates an Etcd Client implementation that uses an in-memory
24// version of the underlying Etcd client.
25func 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
43func newMockKV() *mockKV {

Callers 1

withFixturesFunction · 0.92

Calls 2

DefaultValuesFunction · 0.92
newMockKVFunction · 0.85

Tested by 1

withFixturesFunction · 0.74