Class: Cylons::RemoteDiscovery
- Inherits:
-
Object
- Object
- Cylons::RemoteDiscovery
- Defined in:
- lib/cylons/remote_discovery.rb
Class Attribute Summary collapse
-
.loaded ⇒ Object
(also: loaded?)
Returns the value of attribute loaded.
-
.loaded_remote_class_names ⇒ Object
Returns the value of attribute loaded_remote_class_names.
Class Method Summary collapse
- .namespace_for_agent(agent_name) ⇒ Object
- .remote_class_names ⇒ Object
- .remote_proxy_class_name(namespace, remote_class_name) ⇒ Object
- .service_mappings ⇒ Object
Class Attribute Details
.loaded ⇒ Object Also known as: loaded?
Returns the value of attribute loaded.
7 8 9 |
# File 'lib/cylons/remote_discovery.rb', line 7 def loaded @loaded end |
.loaded_remote_class_names ⇒ Object
Returns the value of attribute loaded_remote_class_names.
7 8 9 |
# File 'lib/cylons/remote_discovery.rb', line 7 def loaded_remote_class_names @loaded_remote_class_names end |
Class Method Details
.namespace_for_agent(agent_name) ⇒ Object
26 27 28 |
# File 'lib/cylons/remote_discovery.rb', line 26 def self.namespace_for_agent(agent_name) service_mappings["#{agent_name}Service".to_sym] end |
.remote_class_names ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/cylons/remote_discovery.rb', line 30 def self.remote_class_names discovered_remote_class_names = [] ::DCell::Node.all.each do |node| if node.id != ::Cylons.configuration.remote_namespace namespace = node.id remote_class_names = node.actors - [:node_manager, :dcell_server, :info] remote_class_names.select{|name| name.to_s.include?("Service") }.each do |remote_class_name| discovered_remote_class_names << remote_class_name end if remote_class_names.any? end end discovered_remote_class_names end |
.remote_proxy_class_name(namespace, remote_class_name) ⇒ Object
46 47 48 |
# File 'lib/cylons/remote_discovery.rb', line 46 def self.remote_proxy_class_name(namespace, remote_class_name) "#{namespace}::#{remote_class_name.to_s}".gsub('Service', '') end |
.service_mappings ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/cylons/remote_discovery.rb', line 11 def self.service_mappings service_mapping_hash = {} ::DCell::Node.all.each do |node| namespace = node.id filtered_nodes = (node.actors - [:node_manager, :dcell_server, :info]) remote_class_names = filtered_nodes.select{|name| name.to_s.include?("Service") }.each do |remote_class_name| service_mapping_hash[remote_class_name] = node.id end end service_mapping_hash end |