Module eetcd

Function Index

close/1close connections with etcd server.
get_prefix_range_end/1
info/0etcd's overview.
new/1Create context for request.
open/2Connects to a etcd server on TCP port Port on the host with IP address Address, such as: open(test,["127.0.0.1:2379","127.0.0.1:2479","127.0.0.1:2579"]).
open/4Connects to a etcd server.
open/5Connects to a etcd server.
with_timeout/2Timeout is an integer greater than zero which specifies how many milliseconds to wait for a reply, or the atom infinity to wait indefinitely.

Function Details

close/1

close(Name::name()) -> ok | {error, eetcd_conn_unavailable}

close connections with etcd server.

get_prefix_range_end/1

get_prefix_range_end(Key) -> any()

info/0

info() -> any()

etcd's overview.

new/1

new(ConnName::atom() | reference()) -> context()

Create context for request.

open/2

open(Name::name(), Hosts::[string()]) -> {ok, pid()} | {error, any()}

Connects to a etcd server on TCP port Port on the host with IP address Address, such as: open(test,["127.0.0.1:2379","127.0.0.1:2479","127.0.0.1:2579"]).

open/4

open(Name::name(), Hosts::[string()], Transport::tcp | tls | ssl, TransportOpts::[gen_tcp:connect_option()] | [ssl:connect_option()]) -> {ok, pid()} | {error, any()}

Connects to a etcd server.

open/5

open(Name::name(), Hosts::[string()], Options::[{mode, connect_all | random} | {name, string()} | {password, string()}], Transport::tcp | tls | ssl, TransportOpts::[gen_tcp:connect_option()] | [ssl:connect_option()]) -> {ok, pid()} | {error, any()}

Connects to a etcd server. ssl:connect_option() see all options in ssl_api.hrl such as [{certfile, Certfile}, {keyfile, Keyfile}] or [{cert, Cert}, {key, Key}].

Default mode is connect_all, it creates multiple sub-connections (one sub-connection per each endpoint). The balancing policy is round robin. For instance, in 5-node cluster, connect_all would require 5 TCP connections, This may consume more resources but provide more flexible load balance with better failover performance. eetcd_conn will do his best to keep all connections normal, and try to reconnect when connection is broken. The reconnect millisecond is 200 400 800 1600 3200 6400 12800 25600, and keep recycling this reconnection time until normal.

{mode, random} creates only one connection to a random endpoint, it would pick one address and use it to send all client requests. The pinned address is maintained until the client connection is closed. When the client receives an error, it randomly picks another normal endpoint.

[{name, string()},{password, string()}] generates an authentication token based on a given user name and password.

You can use eetcd:info/0 to see the internal connection status.

with_timeout/2

with_timeout(Context::context(), Timeout::pos_integer() | infinity) -> context()

Timeout is an integer greater than zero which specifies how many milliseconds to wait for a reply, or the atom infinity to wait indefinitely. If no reply is received within the specified time, the function call fails with {error, timeout}.


Generated by EDoc