Class: RailsRole

Inherits:
Role
  • Object
show all
Defined in:
lib/app_role.rb

Defined Under Namespace

Classes: MyApp

Constant Summary collapse

PORT =
9300

Constants inherited from Role

Role::INDEX

Instance Method Summary collapse

Methods inherited from Role

#disable_link, #enable_link, get_role, #init_links, role, #state

Constructor Details

#initialize(manifest) ⇒ RailsRole

Returns a new instance of RailsRole.



9
10
11
12
13
14
# File 'lib/app_role.rb', line 9

def initialize(manifest)
  super
  init_links 'db_write', @manifest['db_write']
  init_links 'db_read', @manifest['db_read']
  init_links 'db_peer', @manifest['db_peer']
end

Instance Method Details

#startObject Also known as: enable



16
17
18
19
20
21
22
# File 'lib/app_role.rb', line 16

def start
  # @manifest['db'].each do |db_addr|
  #  @db_sockets[db_addr] = DemoSocket.connect(db_addr, DbRole::PORT)
  #end

  start_server
end

#stopObject Also known as: disable



24
25
26
27
# File 'lib/app_role.rb', line 24

def stop
  @http_server.shutdown
  # @db_sockets.each { |a,s| s.close }
end