Class: DruidConfig::Client
- Inherits:
-
Object
- Object
- DruidConfig::Client
- Defined in:
- lib/druid_config/client.rb
Overview
Class to initialize the connection to Zookeeper
Instance Attribute Summary collapse
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
-
#zk ⇒ Object
readonly
Returns the value of attribute zk.
-
#zookeeper ⇒ Object
readonly
Returns the value of attribute zookeeper.
Instance Method Summary collapse
-
#close! ⇒ Object
Close the client.
-
#coordinator ⇒ Object
Get the URL of a coordinator.
-
#initialize(zookeeper, opts = {}) ⇒ Client
constructor
Initialize Zookeeper connection.
-
#overlord ⇒ Object
Get the URI of a overlord.
-
#reset! ⇒ Object
Reset the client.
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
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
6 7 8 |
# File 'lib/druid_config/client.rb', line 6 def opts @opts end |
#zk ⇒ Object (readonly)
Returns the value of attribute zk.
6 7 8 |
# File 'lib/druid_config/client.rb', line 6 def zk @zk end |
#zookeeper ⇒ Object (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 |
#coordinator ⇒ Object
Get the URL of a coordinator
20 21 22 |
# File 'lib/druid_config/client.rb', line 20 def coordinator zk.coordinator end |
#overlord ⇒ Object
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 |