Class: Cylons::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/cylons/connection.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.connectedObject Also known as: connected?

Returns the value of attribute connected.



7
8
9
# File 'lib/cylons/connection.rb', line 7

def connected
  @connected
end

Class Method Details

.connectObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/cylons/connection.rb', line 16

def self.connect
  return if ::Cylons.silence?

  validate_configuration

  ::Cylons.logger.info "STARTING DCELL FOR #{::Cylons.configuration.remote_namespace} NOW"

  ::Cylons.logger.info "Cylons attempting to connect to registry at #{node_address}"

  ::DCell.start :id => ::Cylons.configuration.remote_namespace,
                :addr => node_address,
                :registry => registry_hash

  @connected = true
end

.node_addressObject



32
33
34
# File 'lib/cylons/connection.rb', line 32

def self.node_address
  "tcp://#{::Cylons.configuration.address}:#{::Cylons.configuration.port}"
end

.registry_hashObject



36
37
38
# File 'lib/cylons/connection.rb', line 36

def self.registry_hash
  ::Cylons.configuration.registry
end

.validate_configurationObject



12
13
14
# File 'lib/cylons/connection.rb', line 12

def self.validate_configuration
  raise ::Cylons::RemoteNamespaceNotSet unless ::Cylons.configuration.remote_namespace.present?
end