Module: Etcd

Defined in:
lib/etcd.rb,
lib/etcd/log.rb,
lib/etcd/keys.rb,
lib/etcd/node.rb,
lib/etcd/stats.rb,
lib/etcd/client.rb,
lib/etcd/version.rb,
lib/etcd/mod/lock.rb,
lib/etcd/response.rb,
lib/etcd/exceptions.rb,
lib/etcd/mod/leader.rb

Overview

Provides Etcd namespace

Defined Under Namespace

Modules: Keys, Mod, Stats Classes: Client, DirNotEmpty, Error, EventIndexCleared, IndexNaN, KeyIsPreserved, KeyNotFound, LeaderElect, Log, NoMorePeer, Node, NodeExist, NotDir, NotFile, PrevValueRequired, RaftInternal, Response, TTLNaN, TestFailed, ValueRequired, WatcherCleared

Constant Summary collapse

VERSION =
'0.2.3'
ERROR_CODE_MAPPING =
{
  # command related error
  100 => KeyNotFound,
  101 => TestFailed,
  102 => NotFile,
  103 => NoMorePeer,
  104 => NotDir,
  105 => NodeExist,
  106 => KeyIsPreserved,
  108 => DirNotEmpty,

  # Post form related error
  200 => ValueRequired,
  201 => PrevValueRequired,
  202 => TTLNaN,
  203 => IndexNaN,

  # Raft related error
  300 => RaftInternal,
  301 => LeaderElect,

  # Etcd related error
  400 => WatcherCleared,
  401 => EventIndexCleared
}

Class Method Summary collapse

Class Method Details

.client(opts = {}) ⇒ Object

Create and return a Etcd::Client object. It takes a hash opts as an argument which gets passed to the Etcd::Client.new method directly If opts is not passed default options are used, defined by Etcd::Client.new



13
14
15
16
17
# File 'lib/etcd.rb', line 13

def self.client(opts = {})
  Etcd::Client.new(opts) do |config|
    yield config if block_given?
  end
end