WatchPrefix calls f whenever any value stored under prefix changes. Part of kv.Client interface.
(ctx context.Context, prefix string, f func(string, interface{}) bool)
| 112 | // WatchPrefix calls f whenever any value stored under prefix changes. |
| 113 | // Part of kv.Client interface. |
| 114 | func (c *Client) WatchPrefix(ctx context.Context, prefix string, f func(string, interface{}) bool) { |
| 115 | err := c.awaitKVRunningOrStopping(ctx) |
| 116 | if err != nil { |
| 117 | return |
| 118 | } |
| 119 | |
| 120 | c.kv.WatchPrefix(ctx, prefix, c.codec, f) |
| 121 | } |
| 122 | |
| 123 | // We want to use KV in Running and Stopping states. |
| 124 | func (c *Client) awaitKVRunningOrStopping(ctx context.Context) error { |