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.



36
37
38
39
40
41
42
43
# File 'lib/falcon/controller/host.rb', line 36

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`.



47
48
49
# File 'lib/falcon/controller/host.rb', line 47

def create_container
	@command.container_class.new
end

#setup(container) ⇒ Object

Setup all specified services into the container.



60
61
62
# File 'lib/falcon/controller/host.rb', line 60

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

#startObject

Start all specified services.



52
53
54
55
56
# File 'lib/falcon/controller/host.rb', line 52

def start
	@services.start
	
	super
end

#stopObject

Stop all specified services.



65
66
67
68
69
# File 'lib/falcon/controller/host.rb', line 65

def stop(*)
	@services.stop
	
	super
end