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
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
43 44 45 |
# File 'lib/druid_config/client.rb', line 43 def close! zk.close! end |
#coordinator ⇒ Object
Get the URL of a coordinator.
This funciton can raise a DruidConfig::Exceptions::NotAvailableNodes exception indicating there aren’t any node to process this request
24 25 26 27 |
# File 'lib/druid_config/client.rb', line 24 def coordinator return zk.coordinator if zk.coordinator fail DruidConfig::Exceptions::NotAvailableNodes, 'coordinator' end |
#overlord ⇒ Object
Get the URI of a overlord
This funciton can raise a DruidConfig::Exceptions::NotAvailableNodes exception indicating there aren’t any node to process this request
35 36 37 38 |
# File 'lib/druid_config/client.rb', line 35 def overlord return zk.overlord if zk.overlord fail DruidConfig::Exceptions::NotAvailableNodes, 'overlord' end |