Class: Druid::ZK
- Inherits:
-
Object
- Object
- Druid::ZK
- Defined in:
- lib/druid/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
TODO: Test and handle ZK partitions.
- #register_listener(object, method) ⇒ Object
Constructor Details
#initialize(config) ⇒ ZK
TODO: Test and handle ZK partitions
7 8 9 10 11 12 13 |
# File 'lib/druid/zk.rb', line 7 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/druid/zk.rb', line 4 def client @client end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
4 5 6 |
# File 'lib/druid/zk.rb', line 4 def config @config end |
#listeners ⇒ Object (readonly)
Returns the value of attribute listeners.
4 5 6 |
# File 'lib/druid/zk.rb', line 4 def listeners @listeners end |
#registry ⇒ Object
Returns the value of attribute registry.
3 4 5 |
# File 'lib/druid/zk.rb', line 3 def registry @registry end |
Instance Method Details
#register_listener(object, method) ⇒ Object
15 16 17 |
# File 'lib/druid/zk.rb', line 15 def register_listener(object, method) listeners << ->(*args) { object.send(method, *args) } end |