Class: ProxyMgr::Watcher::Campanjazk
- Defined in:
- lib/proxymgr/watcher/campanja_zk.rb
Instance Attribute Summary
Attributes inherited from Base
#listen_options, #port, #server_options, #servers
Instance Method Summary collapse
Methods inherited from Zookeeper
#shutdown, #validate_config, #watch
Methods inherited from Base
#==, #initialize, #shutdown, #valid?, #watch
Methods included from Logging
Constructor Details
This class inherits a constructor from ProxyMgr::Watcher::Base
Instance Method Details
#update_servers(children) ⇒ Object
13 14 15 16 17 |
# File 'lib/proxymgr/watcher/campanja_zk.rb', line 13 def update_servers(children) servers = children.map { |child| "#{child}:#{@config['port']}" }.sort @servers = servers @manager.update_backends end |
#watch_zookeeper(path, type, req) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/proxymgr/watcher/campanja_zk.rb', line 4 def watch_zookeeper(path, type, req) if type == :update @zk_mapping[path] = ::File.basename(path) else @zk_mapping.delete(path) end update_servers(@zk_mapping.values.sort) end |