You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@celix.apache.org by GitBox <gi...@apache.org> on 2020/09/24 07:22:34 UTC

[GitHub] [celix] Oipo edited a comment on pull request #285: Add API call for retrieving db index

Oipo edited a comment on pull request #285:
URL: https://github.com/apache/celix/pull/285#issuecomment-698164298


   I believe the X-Etcd-Index value is tied to a key. 
   
   If we take a look at the [etcd API](https://etcd.io/docs/v2/api/) description:
   
   > node.createdIndex: an index is a unique, monotonically-incrementing integer created for each change to etcd. This specific index reflects the point in the etcd state member at which a given key was created. You may notice that in this example the index is 2 even though it is the first request you sent to the server. This is because there are internal commands that also change the state behind the scenes, like adding and syncing servers.
   
   It's probably best to do an `etcdlib_get()` before an `etcdlib_watch()`. If the return value is ETCDLIB_RC_ERROR, you can assume it is 0.
   
   Verifying this locally:
   ```
   oipo@oipo-X570-AORUS-ELITE:~$ curl http://127.0.0.1:2379/v2/keys/message3
   {"errorCode":100,"message":"Key not found","cause":"/message3","index":5266}
   oipo@oipo-X570-AORUS-ELITE:~$ curl http://127.0.0.1:2379/v2/keys
   {"action":"get","node":{"dir":true,"nodes":[{"key":"/hier","dir":true,"modifiedIndex":13,"createdIndex":13}]}}
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org