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

Method Put

kv/consul/client.go:113–126  ·  view source on GitHub ↗

Put is mostly here for testing.

(ctx context.Context, key string, value interface{})

Source from the content-addressed store, hash-verified

111
112// Put is mostly here for testing.
113func (c *Client) Put(ctx context.Context, key string, value interface{}) error {
114 bytes, err := c.codec.Encode(value)
115 if err != nil {
116 return err
117 }
118
119 return instrument.CollectedRequest(ctx, "Put", c.consulMetrics.consulRequestDuration, instrument.ErrorCode, func(context.Context) error {
120 _, err := c.kv.Put(&consul.KVPair{
121 Key: key,
122 Value: bytes,
123 }, nil)
124 return err
125 })
126}
127
128// CAS atomically modifies a value in a callback.
129// If value doesn't exist you'll get nil as an argument to your callback.

Callers

nothing calls this directly

Calls 3

CollectedRequestFunction · 0.92
EncodeMethod · 0.65
PutMethod · 0.65

Tested by

no test coverage detected