class DruidConfig::Client
Class to initialize the connection to Zookeeper
Attributes
opts[R]
zk[R]
zookeeper[R]
Public Class Methods
new(zookeeper, opts = {})
click to toggle source
Initialize Zookeeper connection
# File lib/druid_config/client.rb, line 11 def initialize(zookeeper, opts = {}) # Store it for future resets @zookeeper = zookeeper @opts = opts @zk = ZK.new(zookeeper, opts) end
Public Instance Methods
close!()
click to toggle source
Close the client
# File lib/druid_config/client.rb, line 43 def close! zk.close! end
coordinator()
click to toggle source
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
# File lib/druid_config/client.rb, line 24 def coordinator return zk.coordinator if zk.coordinator fail DruidConfig::Exceptions::NotAvailableNodes, 'coordinator' end
overlord()
click to toggle source
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
# File lib/druid_config/client.rb, line 35 def overlord return zk.overlord if zk.overlord fail DruidConfig::Exceptions::NotAvailableNodes, 'overlord' end
reset!()
click to toggle source
Reset the client
# File lib/druid_config/client.rb, line 50 def reset! close! @zk = ZK.new(@zookeeper, @opts) end