Skip to content

team-telnyx/etcdex

Repository files navigation

EtcdEx

Elixir client for the etcd API v3 (gRPC based). All core features are supported. It includes reconnection, transaction, software transactional memory, high-level query builders and lease management, watchers.

Installation

The package can be installed by adding etcdex to your list of dependencies in mix.exs:

def deps do
  [
    {:etcdex, "~> 1.0"}
  ]
end

Documentation is available at HexDocs.

Usage

First, create a connection to your etcd cluster with:

EtcdEx.start_link(name: MyApp.Etcd)

or add one to your supervision tree:

Supervisor.start_link([
  {EtcdEx, name: MyApp.Etcd}
], strategy: :one_for_one)

Get a single key with:

EtcdEx.get(MyApp.Etcd, "/foo")

or list all keys with /foo prefix using:

EtcdEx.get(MyApp.Etcd, "/foo", prefix: true)

or list all keys after /foo using:

EtcdEx.get(MyApp.Etcd, "/foo", from_key: true)

Check the documentation for other options.

Telemetry

EtcdEx uses Telemetry to provide instrumentation. See the EtcdEx.Telemetry module for details on specific events.