kragniz / kragniz/python-etcd3

No way to get the etcd revision from puts and transaction transaction puts

Open
#406 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
450
Forks
194
PR merge metrics
No merged PRs in 30d

Description

We want to check the whole etcd hasn't changed, for reasons... Would it be cool to return them instead of None, something like the following:

```
diff --git a/etcd3/client.py b/etcd3/client.py
index 662d125..55a85df 100644
--- a/etcd3/client.py
+++ b/etcd3/client.py
@@ -346,12 +346,13 @@ class Etcd3Client(object):
:type lease: either :class:`.Lease`, or int (ID of lease)
"""
put_request = self._build_put_request(key, value, lease=lease)
- self.kvstub.Put(
+ meta_data = self.kvstub.Put(
put_request,
self.timeout,
credentials=self.call_credentials,
metadata=self.metadata
)
+ return (True, meta_data)

@_handle_errors
def replace(self, key, initial_value, new_value):
@@ -644,7 +645,7 @@ class Etcd3Client(object):
for response in txn_response.responses:
response_type = response.WhichOneof('response')
if response_type == 'response_put':
- responses.append(None)
+ responses.append(response)

elif response_type == 'response_range':
range_kvs = []

```

Contributor guide

Open the contributing guide

Research direction

Start in etcd3/client.py at the put method and the transaction response loop, then inspect how kvstub.Put metadata and response_put values are currently handled. Done means puts and transaction puts expose the etcd revision metadata instead of returning None, while preserving the existing response behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.