class Falcon::Service::Generic

Designed to be invoked within an {Async::Controller::Container}.
Specifies the interfaces required by derived classes.
Captures the stateful behaviour of a specific service.

def self.wrap(environment)

@parameter environment [Build::Environment] The environment to use to construct the service.
Convert the given environment into a service if possible.
def self.wrap(environment)
	evaluator = environment.evaluator
	service = evaluator.service || self
	
	return service.new(environment)
end

def include?(keys)

This is used for matching environment configuration to service behaviour.
Whether the service environment contains the specified keys.
def include?(keys)
	keys.all?{|key| @environment.include?(key)}
end

def initialize(environment)

@parameter environment [Build::Environment]
Initialize the service from the given environment.
def initialize(environment)
	@environment = environment
	@evaluator = @environment.evaluator
end

def logger

@returns [Console::Logger]
The logger to use for this service.
def logger
	return Async.logger # .with(name: name)
end

def name

e.g. `myapp.com`.
The name of the service.
def name
	@evaluator.name
end

def setup(container)

@parameter container [Async::Container::Generic]
Setup the service into the specified container.
def setup(container)
end

def start

Start the service.
def start
end

def stop

Stop the service.
def stop
end