Class: Falcon::Controller::Host

Inherits:
Async::Container::Controller
  • Object
show all
Defined in:
lib/falcon/controller/host.rb

Overview

A generic controller for serving an application. Hosts several Services based on the command configuration.

The configuration is provided by Falcon::Command::Host and is typically loaded from a ‘falcon.rb` file. See Falcon::Configuration#load_file for more details.

Instance Method Summary collapse

Constructor Details

#initialize(command, **options) ⇒ Host

Initialize the virtual controller.



19
20
21
22
23
24
25
26
# File 'lib/falcon/controller/host.rb', line 19

def initialize(command, **options)
	@command = command
	
	@configuration = command.configuration
	@services = Services.new(@configuration)
	
	super(**options)
end

Instance Method Details

#create_containerObject

Create the controller as specified by the command. e.g. ‘Async::Container::Forked`.



30
31
32
# File 'lib/falcon/controller/host.rb', line 30

def create_container
	@command.container_class.new
end

#setup(container) ⇒ Object

Setup all specified services into the container.



43
44
45
# File 'lib/falcon/controller/host.rb', line 43

def setup(container)
	@services.setup(container)
end

#startObject

Start all specified services.



35
36
37
38
39
# File 'lib/falcon/controller/host.rb', line 35

def start
	@services.start
	
	super
end

#stopObject

Stop all specified services.



48
49
50
51
52
# File 'lib/falcon/controller/host.rb', line 48

def stop(*)
	@services.stop
	
	super
end