Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

Latest commit

 

History

History
43 lines (41 loc) · 1.26 KB

README.md

File metadata and controls

43 lines (41 loc) · 1.26 KB

etcd.erl

Erlang bindings for etcd key value store.

Usage

start

etcd:start()

set

{ok, Response} = etcd:set("http://localhost:4001", "/message", "Hello world", 400).

"/message" is the key and "Hello world" is the value. 400 is the timeout.

get

{ok, Response} = etcd:get("http://localhost:4001", "/message", infinity).

test and set

etcd:set("http://localhost:4001", "/message", "one", infinity),
{ok, Response} = etcd:test_and_set("http://localhost:4001", "/message", "one", "two", infinity).

Directories are also supported:

{ok, Response1} = etcd:set("http://localhost:4001", "/foo/message1", "Hello day", infinity),
{ok, Response2} = etcd:set("http://localhost:4001", "/foo/message2", "Hello night", infinity),
{ok, ResponseList} = etcd:get("http://localhost:4001", "/foo", infinity).

delete

etcd:set("http://localhost:4001", "/message", "Hello world", infinity),
etcd:delete("http://localhost:4001", "/message", infinity).

watch

Result = etcd:watch("http://localhost:4001", "/foo", infinity),

Watch for commands at index 42:

Result = etcd:watch("http://localhost:4001", "/foo", 42, infinity),