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

Method CreateEphemeral

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

Source from the content-addressed store, hash-verified

229}
230
231func (c *Client) CreateEphemeral(path string, data []byte) (<-chan struct{}, error) {
232 c.Lock()
233 defer c.Unlock()
234 if c.closed {
235 return nil, errors.Trace(ErrClosedClient)
236 }
237 cntx, cancel := c.newContext()
238 defer cancel()
239 log.Debugf("etcd create-ephemeral node %s", path)
240 _, err := c.kapi.Set(cntx, path, string(data), &client.SetOptions{PrevExist: client.PrevNoExist, TTL: c.timeout})
241 if err != nil {
242 log.Debugf("etcd create-ephemeral node %s failed: %s", path, err)
243 return nil, errors.Trace(err)
244 }
245 log.Debugf("etcd create-ephemeral OK")
246 return runRefreshEphemeral(c, path), nil
247}
248
249func (c *Client) CreateEphemeralInOrder(path string, data []byte) (<-chan struct{}, string, error) {
250 c.Lock()

Callers

nothing calls this directly

Calls 4

newContextMethod · 0.95
runRefreshEphemeralFunction · 0.85
DebugfMethod · 0.80
SetMethod · 0.45

Tested by

no test coverage detected