MCPcopy Index your code
hub / github.com/CodisLabs/codis / Update

Method Update

pkg/models/etcd/etcdclient.go:143–159  ·  view source on GitHub ↗
(path string, data []byte)

Source from the content-addressed store, hash-verified

141}
142
143func (c *Client) Update(path string, data []byte) error {
144 c.Lock()
145 defer c.Unlock()
146 if c.closed {
147 return errors.Trace(ErrClosedClient)
148 }
149 cntx, cancel := c.newContext()
150 defer cancel()
151 log.Debugf("etcd update node %s", path)
152 _, err := c.kapi.Set(cntx, path, string(data), &client.SetOptions{PrevExist: client.PrevIgnore})
153 if err != nil {
154 log.Debugf("etcd update node %s failed: %s", path, err)
155 return errors.Trace(err)
156 }
157 log.Debugf("etcd update OK")
158 return nil
159}
160
161func (c *Client) Delete(path string) error {
162 c.Lock()

Callers

nothing calls this directly

Calls 3

newContextMethod · 0.95
DebugfMethod · 0.80
SetMethod · 0.45

Tested by

no test coverage detected