Class: Dryad::Cluster::ServiceObserver

Inherits:
Dryad::Consul::ServiceObserver
  • Object
show all
Defined in:
lib/dryad/cluster/service_observer.rb

Instance Method Summary collapse

Constructor Details

#initialize(round_robin) ⇒ ServiceObserver

Returns a new instance of ServiceObserver.



4
5
6
# File 'lib/dryad/cluster/service_observer.rb', line 4

def initialize(round_robin)
  @round_robin = round_robin
end

Instance Method Details

#update_self(service_instances) ⇒ Object



8
9
10
11
# File 'lib/dryad/cluster/service_observer.rb', line 8

def update_self(service_instances)
  sis = service_instances.sort {|a, b| "#{a.address}:#{a.port}" <=> "#{b.address}:#{b.port}"}
  @round_robin.set_services(sis)
end