(path string, data []byte)
| 123 | } |
| 124 | |
| 125 | func (c *Client) Create(path string, data []byte) error { |
| 126 | c.Lock() |
| 127 | defer c.Unlock() |
| 128 | if c.closed { |
| 129 | return errors.Trace(ErrClosedClient) |
| 130 | } |
| 131 | cntx, cancel := c.newContext() |
| 132 | defer cancel() |
| 133 | log.Debugf("etcd create node %s", path) |
| 134 | _, err := c.kapi.Set(cntx, path, string(data), &client.SetOptions{PrevExist: client.PrevNoExist}) |
| 135 | if err != nil { |
| 136 | log.Debugf("etcd create node %s failed: %s", path, err) |
| 137 | return errors.Trace(err) |
| 138 | } |
| 139 | log.Debugf("etcd create OK") |
| 140 | return nil |
| 141 | } |
| 142 | |
| 143 | func (c *Client) Update(path string, data []byte) error { |
| 144 | c.Lock() |
nothing calls this directly
no test coverage detected