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

Method Get

kv/consul/client.go:353–365  ·  view source on GitHub ↗

Get implements kv.Get.

(ctx context.Context, key string)

Source from the content-addressed store, hash-verified

351
352// Get implements kv.Get.
353func (c *Client) Get(ctx context.Context, key string) (interface{}, error) {
354 options := &consul.QueryOptions{
355 AllowStale: !c.cfg.ConsistentReads,
356 RequireConsistent: c.cfg.ConsistentReads,
357 }
358 kvp, _, err := c.kv.Get(key, options.WithContext(ctx))
359 if err != nil {
360 return nil, err
361 } else if kvp == nil {
362 return nil, nil
363 }
364 return c.codec.Decode(kvp.Value)
365}
366
367// Delete implements kv.Delete.
368func (c *Client) Delete(ctx context.Context, key string) error {

Callers

nothing calls this directly

Calls 2

GetMethod · 0.65
DecodeMethod · 0.65

Tested by

no test coverage detected