Class: Dryad::Consul::ServiceRegistry
- Inherits:
-
Object
- Object
- Dryad::Consul::ServiceRegistry
- Includes:
- Singleton
- Defined in:
- lib/dryad/consul/service_registry.rb
Constant Summary collapse
- WATCHER_EXECUTION_INTERVAL =
5 * 60
Instance Method Summary collapse
- #deregister(service) ⇒ Object
-
#initialize ⇒ ServiceRegistry
constructor
A new instance of ServiceRegistry.
- #register(service) ⇒ Object
- #service_instances(name, schema, groups, observer = nil) ⇒ Object
Constructor Details
#initialize ⇒ ServiceRegistry
Returns a new instance of ServiceRegistry.
10 11 12 |
# File 'lib/dryad/consul/service_registry.rb', line 10 def initialize @timers = {} end |
Instance Method Details
#deregister(service) ⇒ Object
20 21 22 23 24 |
# File 'lib/dryad/consul/service_registry.rb', line 20 def deregister(service) service.portals.each do |portal| ::Diplomat::Service.deregister(portal.id) end end |
#register(service) ⇒ Object
14 15 16 17 18 |
# File 'lib/dryad/consul/service_registry.rb', line 14 def register(service) service.to_registers.each do |register| ::Diplomat::Service.register(register) end end |
#service_instances(name, schema, groups, observer = nil) ⇒ Object
26 27 28 29 |
# File 'lib/dryad/consul/service_registry.rb', line 26 def service_instances(name, schema, groups, observer = nil) add_observer(observer, name, schema, groups) unless observer.nil? _service_instances(name, schema, groups) end |