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

Method awaitKVRunningOrStopping

kv/memberlist/memberlist_client.go:124–138  ·  view source on GitHub ↗

We want to use KV in Running and Stopping states.

(ctx context.Context)

Source from the content-addressed store, hash-verified

122
123// We want to use KV in Running and Stopping states.
124func (c *Client) awaitKVRunningOrStopping(ctx context.Context) error {
125 s := c.kv.State()
126 switch s {
127 case services.Running, services.Stopping:
128 return nil
129 case services.New, services.Starting:
130 err := c.kv.AwaitRunning(ctx)
131 if ns := c.kv.State(); ns == services.Stopping {
132 return nil
133 }
134 return err
135 default:
136 return fmt.Errorf("unexpected state: %v", s)
137 }
138}
139
140// KVConfig is a config for memberlist.KV
141type KVConfig struct {

Callers 6

ListMethod · 0.95
GetMethod · 0.95
DeleteMethod · 0.95
CASMethod · 0.95
WatchKeyMethod · 0.95
WatchPrefixMethod · 0.95

Calls 3

ErrorfMethod · 0.80
StateMethod · 0.65
AwaitRunningMethod · 0.65

Tested by

no test coverage detected