Class: CloudBalancer::Server
- Inherits:
-
Object
- Object
- CloudBalancer::Server
- Defined in:
- lib/cloud_balancer/server.rb
Defined Under Namespace
Classes: MessageTypeNotSpecified, UnknownMessageType, UnknownService
Instance Attribute Summary (collapse)
-
- (Object) services
readonly
Returns the value of attribute services.
Instance Method Summary (collapse)
-
- (Object) handle_message(metadata, payload)
Starting point for a new message.
-
- (Server) initialize
constructor
A new instance of Server.
Constructor Details
- (Server) initialize
A new instance of Server
10 11 12 13 14 15 |
# File 'lib/cloud_balancer/server.rb', line 10 def initialize() # TODO: load services from config @services = { :www => { :nodes => [] } } # TODO: load password from config @config = { :cluster_password => "testpass" } end |
Instance Attribute Details
- (Object) services (readonly)
Returns the value of attribute services
8 9 10 |
# File 'lib/cloud_balancer/server.rb', line 8 def services @services end |
Instance Method Details
- (Object) handle_message(metadata, payload)
Starting point for a new message
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/cloud_balancer/server.rb', line 22 def (, payload) = parse_payload(.content_type, payload) if .type case .type.to_sym when :register register_node([:service], [:node], [:password]) else raise UnknownMessageType, "I don't know how to handle message of type #{.type} (Content: #{})." end else raise MessageTypeNotSpecified, "I don't know how to handle this message (#{}), no message type specified." end end |