Class: DruidConfig::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/druid_config/client.rb

Overview

Class to initialize the connection to Zookeeper

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(zookeeper, opts = {}) ⇒ Client

Initialize Zookeeper connection



11
12
13
14
15
# File 'lib/druid_config/client.rb', line 11

def initialize(zookeeper, opts = {})
  @zookeeper = :zk
  @opts = opts
  @zk = ZK.new(zookeeper, opts)
end

Instance Attribute Details

#optsObject (readonly)

Returns the value of attribute opts.



6
7
8
# File 'lib/druid_config/client.rb', line 6

def opts
  @opts
end

#zkObject (readonly)

Returns the value of attribute zk.



6
7
8
# File 'lib/druid_config/client.rb', line 6

def zk
  @zk
end

#zookeeperObject (readonly)

Returns the value of attribute zookeeper.



6
7
8
# File 'lib/druid_config/client.rb', line 6

def zookeeper
  @zookeeper
end

Instance Method Details

#close!Object

Close the client



34
35
36
# File 'lib/druid_config/client.rb', line 34

def close!
  zk.close!
end

#coordinatorObject

Get the URL of a coordinator



20
21
22
# File 'lib/druid_config/client.rb', line 20

def coordinator
  zk.coordinator
end

#overlordObject

Get the URI of a overlord



27
28
29
# File 'lib/druid_config/client.rb', line 27

def overlord
  zk.overlord
end

#reset!Object

Reset the client



41
42
43
44
# File 'lib/druid_config/client.rb', line 41

def reset!
  close!
  @zk = ZK.new(@zookeeper, @opts)
end