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

Method List

kv/etcd/etcd.go:270–280  ·  view source on GitHub ↗

List implements kv.Client.

(ctx context.Context, prefix string)

Source from the content-addressed store, hash-verified

268
269// List implements kv.Client.
270func (c *Client) List(ctx context.Context, prefix string) ([]string, error) {
271 resp, err := c.cli.Get(ctx, prefix, clientv3.WithPrefix(), clientv3.WithKeysOnly())
272 if err != nil {
273 return nil, err
274 }
275 keys := make([]string, 0, len(resp.Kvs))
276 for _, kv := range resp.Kvs {
277 keys = append(keys, string(kv.Key))
278 }
279 return keys, nil
280}
281
282// Get implements kv.Client.
283func (c *Client) Get(ctx context.Context, key string) (interface{}, error) {

Callers

nothing calls this directly

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected