Class: Druid::ZK

Inherits:
Object
  • Object
show all
Defined in:
lib/druid/zk.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#clientObject (readonly)

Returns the value of attribute client.



4
5
6
# File 'lib/druid/zk.rb', line 4

def client
  @client
end

#configObject (readonly)

Returns the value of attribute config.



4
5
6
# File 'lib/druid/zk.rb', line 4

def config
  @config
end

#listenersObject (readonly)

Returns the value of attribute listeners.



4
5
6
# File 'lib/druid/zk.rb', line 4

def listeners
  @listeners
end

#registryObject

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