kragniz / kragniz/python-etcd3
KV metadata in API
- Dominant language
- Python
- Stars
- 450
- Forks
- 194
- PR merge metrics
- No merged PRs in 30d
Description
The current KV api is nice and simple for getting values:
```python
>>> etcd.get("/key")
b"some-value"
```
It doesn't allow for retrieving the metadata about keys, however.
We need to figure out a nice api for showing all the data: key, create_revision, mod_revision, version, value, lease.
How other projects do it:
python-etcd
----------------
python-etcd returns an object for all reads containing a `.value` attribute to read the actual value:
```python
client.read('/nodes/n2').value
#recursively read a directory
r = client.read('/nodes', recursive=True, sorted=True)
for child in r.children:
print("%s: %s" % (child.key,child.value))
```
kazoo (zookeeper)
-------------------------
kazoo returns two values, the data and the node information:
```python
data, stat = zk.get("/my/favorite")
print("Version: %s, data: %s" % (stat.version, data.decode("utf-8")))
```
python-consul
-------------------
python-consul is pretty ugly:
```python
index, data = consul.Consul().kv.get('foo', index=index)
print data['Value']
```
data is a dict that looks like:
```python
{
"CreateIndex": 100,
"ModifyIndex": 200,
"LockIndex": 200,
"Key": "foo",
"Flags": 0,
"Value": "bar",
"Session": "adf4238a-882b-9ddc-4a9d-5b6758e4159e"
}
```
Contributor guide
Research direction
No source file or test is named. Start by locating the current Python KV get API and compare its return value with the metadata fields listed in the issue; done means an agreed API exposes key, create_revision, mod_revision, version, value, and lease.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100