forked from stianeikeland/node-etcd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8fbf5b5
commit 9a16f2d
Showing
1 changed file
with
32 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,46 @@ | ||
# node-etcd | ||
|
||
A work in progress nodejs library for [etcd](http://github.com/coreos/etcd) | ||
A nodejs library for [etcd](http://github.com/coreos/etcd), written in coffee-script. | ||
|
||
Only supports simple get, set, delete operations for now. | ||
Travis-CI: [![Build Status](https://travis-ci.org/stianeikeland/node-etcd.png)](https://travis-ci.org/stianeikeland/node-etcd) | ||
|
||
## Example | ||
|
||
```coffeescript | ||
# Example in coffee-script | ||
|
||
EtcdClient = require 'node-etcd' | ||
|
||
c = new EtcdClient | ||
# Coffee-script examples: | ||
Etcd = require 'node-etcd' | ||
c = new Etcd | ||
|
||
# Set a value | ||
c.set "/key", "value", (err, val) -> | ||
console.log err, val | ||
|
||
# Get a value | ||
c.get "/key", (err, val) -> | ||
console.log err, val | ||
|
||
# Delete a value | ||
c.del "/key", (err, val) -> | ||
console.log err, val | ||
|
||
# Watch a value | ||
c.watch "/key", (err, val) -> | ||
console.log err, val | ||
|
||
# Set with expiry (time to live) | ||
c.setTTL "/key", "value", 5, (err, val) -> | ||
console.log err, val | ||
|
||
# Atomic setting (test and set) | ||
c.setTest "/key", "new value", "old value", (err, val) -> | ||
console.log err, val | ||
|
||
# List machines in the etcd cluster | ||
c.machines (err, val) -> | ||
console.log err, val | ||
|
||
# Get the leader of the cluster | ||
c.leader (err, val) -> | ||
console.log err, val | ||
|
||
``` |