blob: 8439afebab51bb22b73ffde5b53e206a3e814270 [file] [log] [blame]
Scott Baker2c1c4822019-10-16 11:02:41 -07001/*
Joey Armstrong9cdee9f2024-01-03 04:56:14 -05002* Copyright 2018-2024 Open Networking Foundation (ONF) and the ONF Contributors
Scott Baker2c1c4822019-10-16 11:02:41 -07003
Joey Armstrong7f8436c2023-07-09 20:23:27 -04004* Licensed under the Apache License, Version 2.0 (the "License");
5* you may not use this file except in compliance with the License.
6* You may obtain a copy of the License at
Scott Baker2c1c4822019-10-16 11:02:41 -07007
Joey Armstrong7f8436c2023-07-09 20:23:27 -04008* http://www.apache.org/licenses/LICENSE-2.0
Scott Baker2c1c4822019-10-16 11:02:41 -07009
Joey Armstrong7f8436c2023-07-09 20:23:27 -040010* Unless required by applicable law or agreed to in writing, software
11* distributed under the License is distributed on an "AS IS" BASIS,
12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13* See the License for the specific language governing permissions and
14* limitations under the License.
Scott Baker2c1c4822019-10-16 11:02:41 -070015 */
16package kvstore
17
18import (
19 "context"
20 "errors"
21 "fmt"
khenaidoo6f415b22021-06-22 18:08:53 -040022 "os"
23 "strconv"
24 "sync"
25 "time"
khenaidoo26721882021-08-11 17:42:52 -040026
27 "github.com/opencord/voltha-lib-go/v7/pkg/log"
28 v3Client "go.etcd.io/etcd/clientv3"
29 v3rpcTypes "go.etcd.io/etcd/etcdserver/api/v3rpc/rpctypes"
khenaidoo6f415b22021-06-22 18:08:53 -040030)
31
32const (
33 poolCapacityEnvName = "VOLTHA_ETCD_CLIENT_POOL_CAPACITY"
34 maxUsageEnvName = "VOLTHA_ETCD_CLIENT_MAX_USAGE"
35)
36
37const (
38 defaultMaxPoolCapacity = 1000 // Default size of an Etcd Client pool
39 defaultMaxPoolUsage = 100 // Maximum concurrent request an Etcd Client is allowed to process
Scott Baker2c1c4822019-10-16 11:02:41 -070040)
41
42// EtcdClient represents the Etcd KV store client
43type EtcdClient struct {
khenaidoo6f415b22021-06-22 18:08:53 -040044 pool EtcdClientAllocator
45 watchedChannels sync.Map
46 watchedClients map[string]*v3Client.Client
47 watchedClientsLock sync.RWMutex
Scott Baker2c1c4822019-10-16 11:02:41 -070048}
49
David K. Bainbridgebc381072021-03-19 20:56:04 +000050// NewEtcdCustomClient returns a new client for the Etcd KV store allowing
51// the called to specify etcd client configuration
khenaidoo6f415b22021-06-22 18:08:53 -040052func NewEtcdCustomClient(ctx context.Context, addr string, timeout time.Duration, level log.LogLevel) (*EtcdClient, error) {
53 // Get the capacity and max usage from the environment
54 capacity := defaultMaxPoolCapacity
55 maxUsage := defaultMaxPoolUsage
56 if capacityStr, present := os.LookupEnv(poolCapacityEnvName); present {
57 if val, err := strconv.Atoi(capacityStr); err == nil {
58 capacity = val
59 logger.Infow(ctx, "env-variable-set", log.Fields{"pool-capacity": capacity})
60 } else {
61 logger.Warnw(ctx, "invalid-capacity-value", log.Fields{"error": err, "capacity": capacityStr})
62 }
63 }
64 if maxUsageStr, present := os.LookupEnv(maxUsageEnvName); present {
65 if val, err := strconv.Atoi(maxUsageStr); err == nil {
66 maxUsage = val
67 logger.Infow(ctx, "env-variable-set", log.Fields{"max-usage": maxUsage})
68 } else {
69 logger.Warnw(ctx, "invalid-max-usage-value", log.Fields{"error": err, "max-usage": maxUsageStr})
70 }
Scott Baker2c1c4822019-10-16 11:02:41 -070071 }
72
khenaidoo6f415b22021-06-22 18:08:53 -040073 var err error
Scott Baker2c1c4822019-10-16 11:02:41 -070074
khenaidoo6f415b22021-06-22 18:08:53 -040075 pool, err := NewRoundRobinEtcdClientAllocator([]string{addr}, timeout, capacity, maxUsage, level)
76 if err != nil {
77 logger.Errorw(ctx, "failed-to-create-rr-client", log.Fields{
78 "error": err,
79 })
80 }
81
82 logger.Infow(ctx, "etcd-pool-created", log.Fields{"capacity": capacity, "max-usage": maxUsage})
83
84 return &EtcdClient{pool: pool,
85 watchedClients: make(map[string]*v3Client.Client),
86 }, nil
Scott Baker2c1c4822019-10-16 11:02:41 -070087}
88
David K. Bainbridgebc381072021-03-19 20:56:04 +000089// NewEtcdClient returns a new client for the Etcd KV store
90func NewEtcdClient(ctx context.Context, addr string, timeout time.Duration, level log.LogLevel) (*EtcdClient, error) {
khenaidoo6f415b22021-06-22 18:08:53 -040091 return NewEtcdCustomClient(ctx, addr, timeout, level)
David K. Bainbridgebc381072021-03-19 20:56:04 +000092}
93
Scott Baker2c1c4822019-10-16 11:02:41 -070094// IsConnectionUp returns whether the connection to the Etcd KV store is up. If a timeout occurs then
95// it is assumed the connection is down or unreachable.
npujar5bf737f2020-01-16 19:35:25 +053096func (c *EtcdClient) IsConnectionUp(ctx context.Context) bool {
Scott Baker2c1c4822019-10-16 11:02:41 -070097 // Let's try to get a non existent key. If the connection is up then there will be no error returned.
npujar5bf737f2020-01-16 19:35:25 +053098 if _, err := c.Get(ctx, "non-existent-key"); err != nil {
Scott Baker2c1c4822019-10-16 11:02:41 -070099 return false
100 }
101 return true
102}
103
104// List returns an array of key-value pairs with key as a prefix. Timeout defines how long the function will
105// wait for a response
npujar5bf737f2020-01-16 19:35:25 +0530106func (c *EtcdClient) List(ctx context.Context, key string) (map[string]*KVPair, error) {
khenaidoo6f415b22021-06-22 18:08:53 -0400107 client, err := c.pool.Get(ctx)
108 if err != nil {
109 return nil, err
110 }
111 defer c.pool.Put(client)
112 resp, err := client.Get(ctx, key, v3Client.WithPrefix())
113
Scott Baker2c1c4822019-10-16 11:02:41 -0700114 if err != nil {
Neha Sharma94f16a92020-06-26 04:17:55 +0000115 logger.Error(ctx, err)
Scott Baker2c1c4822019-10-16 11:02:41 -0700116 return nil, err
117 }
118 m := make(map[string]*KVPair)
119 for _, ev := range resp.Kvs {
120 m[string(ev.Key)] = NewKVPair(string(ev.Key), ev.Value, "", ev.Lease, ev.Version)
121 }
122 return m, nil
123}
124
125// Get returns a key-value pair for a given key. Timeout defines how long the function will
126// wait for a response
npujar5bf737f2020-01-16 19:35:25 +0530127func (c *EtcdClient) Get(ctx context.Context, key string) (*KVPair, error) {
khenaidoo6f415b22021-06-22 18:08:53 -0400128 client, err := c.pool.Get(ctx)
129 if err != nil {
130 return nil, err
131 }
132 defer c.pool.Put(client)
Scott Baker2c1c4822019-10-16 11:02:41 -0700133
Girish Gowdra248971a2021-06-01 15:14:15 -0700134 attempt := 0
khenaidoo6f415b22021-06-22 18:08:53 -0400135
Girish Gowdra248971a2021-06-01 15:14:15 -0700136startLoop:
137 for {
khenaidoo6f415b22021-06-22 18:08:53 -0400138 resp, err := client.Get(ctx, key)
Girish Gowdra248971a2021-06-01 15:14:15 -0700139 if err != nil {
140 switch err {
141 case context.Canceled:
142 logger.Warnw(ctx, "context-cancelled", log.Fields{"error": err})
143 case context.DeadlineExceeded:
144 logger.Warnw(ctx, "context-deadline-exceeded", log.Fields{"error": err, "context": ctx})
145 case v3rpcTypes.ErrEmptyKey:
146 logger.Warnw(ctx, "etcd-client-error", log.Fields{"error": err})
147 case v3rpcTypes.ErrLeaderChanged,
148 v3rpcTypes.ErrGRPCNoLeader,
149 v3rpcTypes.ErrTimeout,
150 v3rpcTypes.ErrTimeoutDueToLeaderFail,
151 v3rpcTypes.ErrTimeoutDueToConnectionLost:
152 // Retry for these server errors
153 attempt += 1
154 if er := backoff(ctx, attempt); er != nil {
155 logger.Warnw(ctx, "get-retries-failed", log.Fields{"key": key, "error": er, "attempt": attempt})
156 return nil, err
157 }
158 logger.Warnw(ctx, "retrying-get", log.Fields{"key": key, "error": err, "attempt": attempt})
159 goto startLoop
160 default:
161 logger.Warnw(ctx, "etcd-server-error", log.Fields{"error": err})
162 }
163 return nil, err
164 }
npujar5bf737f2020-01-16 19:35:25 +0530165
Girish Gowdra248971a2021-06-01 15:14:15 -0700166 for _, ev := range resp.Kvs {
167 // Only one value is returned
168 return NewKVPair(string(ev.Key), ev.Value, "", ev.Lease, ev.Version), nil
169 }
170 return nil, nil
Scott Baker2c1c4822019-10-16 11:02:41 -0700171 }
Scott Baker2c1c4822019-10-16 11:02:41 -0700172}
173
174// Put writes a key-value pair to the KV store. Value can only be a string or []byte since the etcd API
175// accepts only a string as a value for a put operation. Timeout defines how long the function will
176// wait for a response
npujar5bf737f2020-01-16 19:35:25 +0530177func (c *EtcdClient) Put(ctx context.Context, key string, value interface{}) error {
Scott Baker2c1c4822019-10-16 11:02:41 -0700178
179 // Validate that we can convert value to a string as etcd API expects a string
180 var val string
khenaidoo6f415b22021-06-22 18:08:53 -0400181 var err error
182 if val, err = ToString(value); err != nil {
Scott Baker2c1c4822019-10-16 11:02:41 -0700183 return fmt.Errorf("unexpected-type-%T", value)
184 }
185
khenaidoo6f415b22021-06-22 18:08:53 -0400186 client, err := c.pool.Get(ctx)
187 if err != nil {
188 return err
189 }
190 defer c.pool.Put(client)
191
Girish Gowdra248971a2021-06-01 15:14:15 -0700192 attempt := 0
193startLoop:
194 for {
khenaidoo6f415b22021-06-22 18:08:53 -0400195 _, err = client.Put(ctx, key, val)
Girish Gowdra248971a2021-06-01 15:14:15 -0700196 if err != nil {
197 switch err {
198 case context.Canceled:
199 logger.Warnw(ctx, "context-cancelled", log.Fields{"error": err})
200 case context.DeadlineExceeded:
201 logger.Warnw(ctx, "context-deadline-exceeded", log.Fields{"error": err, "context": ctx})
202 case v3rpcTypes.ErrEmptyKey:
203 logger.Warnw(ctx, "etcd-client-error", log.Fields{"error": err})
204 case v3rpcTypes.ErrLeaderChanged,
205 v3rpcTypes.ErrGRPCNoLeader,
206 v3rpcTypes.ErrTimeout,
207 v3rpcTypes.ErrTimeoutDueToLeaderFail,
208 v3rpcTypes.ErrTimeoutDueToConnectionLost:
209 // Retry for these server errors
210 attempt += 1
211 if er := backoff(ctx, attempt); er != nil {
212 logger.Warnw(ctx, "put-retries-failed", log.Fields{"key": key, "error": er, "attempt": attempt})
213 return err
214 }
215 logger.Warnw(ctx, "retrying-put", log.Fields{"key": key, "error": err, "attempt": attempt})
216 goto startLoop
217 default:
218 logger.Warnw(ctx, "etcd-server-error", log.Fields{"error": err})
219 }
220 return err
221 }
222 return nil
Scott Baker2c1c4822019-10-16 11:02:41 -0700223 }
Scott Baker2c1c4822019-10-16 11:02:41 -0700224}
225
226// Delete removes a key from the KV store. Timeout defines how long the function will
227// wait for a response
npujar5bf737f2020-01-16 19:35:25 +0530228func (c *EtcdClient) Delete(ctx context.Context, key string) error {
khenaidoo6f415b22021-06-22 18:08:53 -0400229 client, err := c.pool.Get(ctx)
230 if err != nil {
231 return err
232 }
233 defer c.pool.Put(client)
Scott Baker2c1c4822019-10-16 11:02:41 -0700234
Girish Gowdra248971a2021-06-01 15:14:15 -0700235 attempt := 0
236startLoop:
237 for {
khenaidoo6f415b22021-06-22 18:08:53 -0400238 _, err = client.Delete(ctx, key)
Girish Gowdra248971a2021-06-01 15:14:15 -0700239 if err != nil {
240 switch err {
241 case context.Canceled:
242 logger.Warnw(ctx, "context-cancelled", log.Fields{"error": err})
243 case context.DeadlineExceeded:
244 logger.Warnw(ctx, "context-deadline-exceeded", log.Fields{"error": err, "context": ctx})
245 case v3rpcTypes.ErrEmptyKey:
246 logger.Warnw(ctx, "etcd-client-error", log.Fields{"error": err})
247 case v3rpcTypes.ErrLeaderChanged,
248 v3rpcTypes.ErrGRPCNoLeader,
249 v3rpcTypes.ErrTimeout,
250 v3rpcTypes.ErrTimeoutDueToLeaderFail,
251 v3rpcTypes.ErrTimeoutDueToConnectionLost:
252 // Retry for these server errors
253 attempt += 1
254 if er := backoff(ctx, attempt); er != nil {
255 logger.Warnw(ctx, "delete-retries-failed", log.Fields{"key": key, "error": er, "attempt": attempt})
256 return err
257 }
258 logger.Warnw(ctx, "retrying-delete", log.Fields{"key": key, "error": err, "attempt": attempt})
259 goto startLoop
260 default:
261 logger.Warnw(ctx, "etcd-server-error", log.Fields{"error": err})
262 }
263 return err
264 }
265 logger.Debugw(ctx, "key(s)-deleted", log.Fields{"key": key})
266 return nil
Scott Baker2c1c4822019-10-16 11:02:41 -0700267 }
Scott Baker2c1c4822019-10-16 11:02:41 -0700268}
269
Serkant Uluderya198de902020-11-16 20:29:17 +0300270func (c *EtcdClient) DeleteWithPrefix(ctx context.Context, prefixKey string) error {
271
khenaidoo6f415b22021-06-22 18:08:53 -0400272 client, err := c.pool.Get(ctx)
273 if err != nil {
274 return err
275 }
276 defer c.pool.Put(client)
277
Serkant Uluderya198de902020-11-16 20:29:17 +0300278 //delete the prefix
khenaidoo6f415b22021-06-22 18:08:53 -0400279 if _, err := client.Delete(ctx, prefixKey, v3Client.WithPrefix()); err != nil {
Serkant Uluderya198de902020-11-16 20:29:17 +0300280 logger.Errorw(ctx, "failed-to-delete-prefix-key", log.Fields{"key": prefixKey, "error": err})
281 return err
282 }
283 logger.Debugw(ctx, "key(s)-deleted", log.Fields{"key": prefixKey})
284 return nil
285}
286
Scott Baker2c1c4822019-10-16 11:02:41 -0700287// Watch provides the watch capability on a given key. It returns a channel onto which the callee needs to
288// listen to receive Events.
divyadesai8bf96862020-02-07 12:24:26 +0000289func (c *EtcdClient) Watch(ctx context.Context, key string, withPrefix bool) chan *Event {
khenaidoo6f415b22021-06-22 18:08:53 -0400290 var err error
291 // Reuse the Etcd client when multiple callees are watching the same key.
292 c.watchedClientsLock.Lock()
293 client, exist := c.watchedClients[key]
294 if !exist {
295 client, err = c.pool.Get(ctx)
296 if err != nil {
297 logger.Errorw(ctx, "failed-to-an-etcd-client", log.Fields{"key": key, "error": err})
298 c.watchedClientsLock.Unlock()
299 return nil
300 }
301 c.watchedClients[key] = client
302 }
303 c.watchedClientsLock.Unlock()
304
305 w := v3Client.NewWatcher(client)
npujar5bf737f2020-01-16 19:35:25 +0530306 ctx, cancel := context.WithCancel(ctx)
divyadesai8bf96862020-02-07 12:24:26 +0000307 var channel v3Client.WatchChan
308 if withPrefix {
309 channel = w.Watch(ctx, key, v3Client.WithPrefix())
310 } else {
311 channel = w.Watch(ctx, key)
312 }
Scott Baker2c1c4822019-10-16 11:02:41 -0700313
314 // Create a new channel
315 ch := make(chan *Event, maxClientChannelBufferSize)
316
317 // Keep track of the created channels so they can be closed when required
318 channelMap := make(map[chan *Event]v3Client.Watcher)
319 channelMap[ch] = w
Scott Baker2c1c4822019-10-16 11:02:41 -0700320 channelMaps := c.addChannelMap(key, channelMap)
321
322 // Changing the log field (from channelMaps) as the underlying logger cannot format the map of channels into a
323 // json format.
Neha Sharma94f16a92020-06-26 04:17:55 +0000324 logger.Debugw(ctx, "watched-channels", log.Fields{"len": len(channelMaps)})
Scott Baker2c1c4822019-10-16 11:02:41 -0700325 // Launch a go routine to listen for updates
Neha Sharma94f16a92020-06-26 04:17:55 +0000326 go c.listenForKeyChange(ctx, channel, ch, cancel)
Scott Baker2c1c4822019-10-16 11:02:41 -0700327
328 return ch
329
330}
331
332func (c *EtcdClient) addChannelMap(key string, channelMap map[chan *Event]v3Client.Watcher) []map[chan *Event]v3Client.Watcher {
333 var channels interface{}
334 var exists bool
335
336 if channels, exists = c.watchedChannels.Load(key); exists {
337 channels = append(channels.([]map[chan *Event]v3Client.Watcher), channelMap)
338 } else {
339 channels = []map[chan *Event]v3Client.Watcher{channelMap}
340 }
341 c.watchedChannels.Store(key, channels)
342
343 return channels.([]map[chan *Event]v3Client.Watcher)
344}
345
346func (c *EtcdClient) removeChannelMap(key string, pos int) []map[chan *Event]v3Client.Watcher {
347 var channels interface{}
348 var exists bool
349
350 if channels, exists = c.watchedChannels.Load(key); exists {
351 channels = append(channels.([]map[chan *Event]v3Client.Watcher)[:pos], channels.([]map[chan *Event]v3Client.Watcher)[pos+1:]...)
352 c.watchedChannels.Store(key, channels)
353 }
354
355 return channels.([]map[chan *Event]v3Client.Watcher)
356}
357
358func (c *EtcdClient) getChannelMaps(key string) ([]map[chan *Event]v3Client.Watcher, bool) {
359 var channels interface{}
360 var exists bool
361
362 channels, exists = c.watchedChannels.Load(key)
363
364 if channels == nil {
365 return nil, exists
366 }
367
368 return channels.([]map[chan *Event]v3Client.Watcher), exists
369}
370
371// CloseWatch closes a specific watch. Both the key and the channel are required when closing a watch as there
372// may be multiple listeners on the same key. The previously created channel serves as a key
Neha Sharma94f16a92020-06-26 04:17:55 +0000373func (c *EtcdClient) CloseWatch(ctx context.Context, key string, ch chan *Event) {
Scott Baker2c1c4822019-10-16 11:02:41 -0700374 // Get the array of channels mapping
375 var watchedChannels []map[chan *Event]v3Client.Watcher
376 var ok bool
Scott Baker2c1c4822019-10-16 11:02:41 -0700377
378 if watchedChannels, ok = c.getChannelMaps(key); !ok {
Neha Sharma94f16a92020-06-26 04:17:55 +0000379 logger.Warnw(ctx, "key-has-no-watched-channels", log.Fields{"key": key})
Scott Baker2c1c4822019-10-16 11:02:41 -0700380 return
381 }
382 // Look for the channels
383 var pos = -1
384 for i, chMap := range watchedChannels {
385 if t, ok := chMap[ch]; ok {
Neha Sharma94f16a92020-06-26 04:17:55 +0000386 logger.Debug(ctx, "channel-found")
Scott Baker2c1c4822019-10-16 11:02:41 -0700387 // Close the etcd watcher before the client channel. This should close the etcd channel as well
388 if err := t.Close(); err != nil {
Neha Sharma94f16a92020-06-26 04:17:55 +0000389 logger.Errorw(ctx, "watcher-cannot-be-closed", log.Fields{"key": key, "error": err})
Scott Baker2c1c4822019-10-16 11:02:41 -0700390 }
391 pos = i
392 break
393 }
394 }
395
396 channelMaps, _ := c.getChannelMaps(key)
397 // Remove that entry if present
398 if pos >= 0 {
399 channelMaps = c.removeChannelMap(key, pos)
400 }
khenaidoo6f415b22021-06-22 18:08:53 -0400401
402 // If we don't have any keys being watched then return the Etcd client to the pool
403 if len(channelMaps) == 0 {
404 c.watchedClientsLock.Lock()
405 // Sanity
406 if client, ok := c.watchedClients[key]; ok {
407 c.pool.Put(client)
408 delete(c.watchedClients, key)
409 }
410 c.watchedClientsLock.Unlock()
411 }
Neha Sharma94f16a92020-06-26 04:17:55 +0000412 logger.Infow(ctx, "watcher-channel-exiting", log.Fields{"key": key, "channel": channelMaps})
Scott Baker2c1c4822019-10-16 11:02:41 -0700413}
414
Neha Sharma94f16a92020-06-26 04:17:55 +0000415func (c *EtcdClient) listenForKeyChange(ctx context.Context, channel v3Client.WatchChan, ch chan<- *Event, cancel context.CancelFunc) {
416 logger.Debug(ctx, "start-listening-on-channel ...")
Scott Baker2c1c4822019-10-16 11:02:41 -0700417 defer cancel()
418 defer close(ch)
419 for resp := range channel {
420 for _, ev := range resp.Events {
421 ch <- NewEvent(getEventType(ev), ev.Kv.Key, ev.Kv.Value, ev.Kv.Version)
422 }
423 }
Neha Sharma94f16a92020-06-26 04:17:55 +0000424 logger.Debug(ctx, "stop-listening-on-channel ...")
Scott Baker2c1c4822019-10-16 11:02:41 -0700425}
426
427func getEventType(event *v3Client.Event) int {
428 switch event.Type {
429 case v3Client.EventTypePut:
430 return PUT
431 case v3Client.EventTypeDelete:
432 return DELETE
433 }
434 return UNKNOWN
435}
436
khenaidoo6f415b22021-06-22 18:08:53 -0400437// Close closes all the connection in the pool store client
Neha Sharma94f16a92020-06-26 04:17:55 +0000438func (c *EtcdClient) Close(ctx context.Context) {
khenaidoo6f415b22021-06-22 18:08:53 -0400439 logger.Debug(ctx, "closing-etcd-pool")
440 c.pool.Close(ctx)
Scott Baker2c1c4822019-10-16 11:02:41 -0700441}
442
khenaidoo6f415b22021-06-22 18:08:53 -0400443// The APIs below are not used
444var errUnimplemented = errors.New("deprecated")
445
446// Reserve is deprecated
447func (c *EtcdClient) Reserve(ctx context.Context, key string, value interface{}, ttl time.Duration) (interface{}, error) {
448 return nil, errUnimplemented
Scott Baker2c1c4822019-10-16 11:02:41 -0700449}
450
khenaidoo6f415b22021-06-22 18:08:53 -0400451// ReleaseAllReservations is deprecated
452func (c *EtcdClient) ReleaseAllReservations(ctx context.Context) error {
453 return errUnimplemented
Scott Baker2c1c4822019-10-16 11:02:41 -0700454}
455
khenaidoo6f415b22021-06-22 18:08:53 -0400456// ReleaseReservation is deprecated
457func (c *EtcdClient) ReleaseReservation(ctx context.Context, key string) error {
458 return errUnimplemented
Scott Baker2c1c4822019-10-16 11:02:41 -0700459}
460
khenaidoo6f415b22021-06-22 18:08:53 -0400461// RenewReservation is deprecated
462func (c *EtcdClient) RenewReservation(ctx context.Context, key string) error {
463 return errUnimplemented
464}
465
466// AcquireLock is deprecated
Neha Sharma130ac6d2020-04-08 08:46:32 +0000467func (c *EtcdClient) AcquireLock(ctx context.Context, lockName string, timeout time.Duration) error {
khenaidoo6f415b22021-06-22 18:08:53 -0400468 return errUnimplemented
Scott Baker2c1c4822019-10-16 11:02:41 -0700469}
470
khenaidoo6f415b22021-06-22 18:08:53 -0400471// ReleaseLock is deprecated
Scott Baker2c1c4822019-10-16 11:02:41 -0700472func (c *EtcdClient) ReleaseLock(lockName string) error {
khenaidoo6f415b22021-06-22 18:08:53 -0400473 return errUnimplemented
Scott Baker2c1c4822019-10-16 11:02:41 -0700474}