Put is mostly here for testing.
(ctx context.Context, key string, value interface{})
| 111 | |
| 112 | // Put is mostly here for testing. |
| 113 | func (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. |
nothing calls this directly
no test coverage detected