Class: DruidDB::ZK
- Inherits:
-
Object
- Object
- DruidDB::ZK
- Defined in:
- lib/druiddb/zk.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#listeners ⇒ Object
readonly
Returns the value of attribute listeners.
-
#registry ⇒ Object
Returns the value of attribute registry.
Instance Method Summary collapse
-
#initialize(config) ⇒ ZK
constructor
A new instance of ZK.
- #register_listener(object, method) ⇒ Object
Constructor Details
#initialize(config) ⇒ ZK
Returns a new instance of ZK.
6 7 8 9 10 11 12 |
# File 'lib/druiddb/zk.rb', line 6 def initialize(config) @client = ::ZK.new(config.zookeeper) @config = config @listeners = [] @registry = {} register end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
4 5 6 |
# File 'lib/druiddb/zk.rb', line 4 def client @client end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
4 5 6 |
# File 'lib/druiddb/zk.rb', line 4 def config @config end |
#listeners ⇒ Object (readonly)
Returns the value of attribute listeners.
4 5 6 |
# File 'lib/druiddb/zk.rb', line 4 def listeners @listeners end |
#registry ⇒ Object
Returns the value of attribute registry.
3 4 5 |
# File 'lib/druiddb/zk.rb', line 3 def registry @registry end |
Instance Method Details
#register_listener(object, method) ⇒ Object
14 15 16 |
# File 'lib/druiddb/zk.rb', line 14 def register_listener(object, method) listeners << ->(*args) { object.send(method, *args) } end |