https://github.com/binocarlos/etcdx
node client for etcd v2 that adheres to waitIndex for watching
https://github.com/binocarlos/etcdx
Last synced: 8 months ago
JSON representation
node client for etcd v2 that adheres to waitIndex for watching
- Host: GitHub
- URL: https://github.com/binocarlos/etcdx
- Owner: binocarlos
- Created: 2013-12-22T20:17:55.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-12-22T23:03:53.000Z (almost 12 years ago)
- Last Synced: 2025-02-05T10:50:45.700Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 129 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# etcdx

node client for etcd v2 that adheres to waitIndex for watching.
## example
```js
var etcdx = require('etcdx');
var client = new etcdx();
client.watch('/mongo_servers', true, function(error, server){
// server is 'hello' then 'hello2'
})
client.set('/mongo_servers/server1', 'hello');
client.set('/mongo_servers/server1', 'hello2');
```
## install
```
$ npm install etcdx
```
## methods
### configure(opts)
set the following options for further requests to the etcd server:
* protocol
* host
* port
* version
## watch(key, recursive, trigger)
run 'trigger' each time a value at or below 'key' changes
'recursive' controls how deep we are watching
this function looks at the global etcd waitIndex in case a value has changed in-between our watch requests
## get(key, done)
return the value of 'key'
## set(key, value, done)
set the value of 'key'
## set_ttl(key, value, ttl, done)
set the value of 'key' for 'ttl' seconds
## del(key, done)
remove 'key'
## ls(key, recursive, done)
list the entries below 'key' - recursive follows nested directories
## mkdir(key, done)
create a directory (with no value) at 'key'
## rmdir(key, done)
remove all values below key
## licence
MIT