Module: Async::Service::Supervisor::Environment
- Includes:
- Managed::Environment
- Defined in:
- lib/async/service/supervisor/environment.rb
Overview
An environment mixin for supervisor services.
Provides configuration and setup for supervisor processes that monitor workers.
Instance Method Summary collapse
-
#container_options ⇒ Object
Options to use when creating the container.
-
#count ⇒ Object
Number of supervisor instances (always 1).
-
#endpoint ⇒ Object
The endpoint the supervisor will bind to.
-
#ipc_path ⇒ Object
The IPC path to use for communication with the supervisor.
-
#make_server(endpoint) ⇒ Object
Create the supervisor server instance.
-
#monitors ⇒ Object
Get the list of monitors to run in the supervisor.
-
#name ⇒ Object
The name of the supervisor.
-
#service_class ⇒ Object
The service class to use for the supervisor.
Instance Method Details
#container_options ⇒ Object
Options to use when creating the container. Merges with Managed::Environment defaults.
53 54 55 |
# File 'lib/async/service/supervisor/environment.rb', line 53 def super.merge(restart: true, count: self.count) end |
#count ⇒ Object
Number of supervisor instances (always 1).
47 48 49 |
# File 'lib/async/service/supervisor/environment.rb', line 47 def count 1 end |
#endpoint ⇒ Object
The endpoint the supervisor will bind to.
41 42 43 |
# File 'lib/async/service/supervisor/environment.rb', line 41 def endpoint ::IO::Endpoint.unix(ipc_path) end |
#ipc_path ⇒ Object
The IPC path to use for communication with the supervisor.
35 36 37 |
# File 'lib/async/service/supervisor/environment.rb', line 35 def ipc_path ::File.("supervisor.ipc", root) end |
#make_server(endpoint) ⇒ Object
Create the supervisor server instance.
69 70 71 |
# File 'lib/async/service/supervisor/environment.rb', line 69 def make_server(endpoint) Server.new(endpoint: endpoint, monitors: self.monitors) end |
#monitors ⇒ Object
Get the list of monitors to run in the supervisor.
Override this method to provide custom monitors.
62 63 64 |
# File 'lib/async/service/supervisor/environment.rb', line 62 def monitors [] end |
#name ⇒ Object
The name of the supervisor
29 30 31 |
# File 'lib/async/service/supervisor/environment.rb', line 29 def name "supervisor" end |
#service_class ⇒ Object
The service class to use for the supervisor.
23 24 25 |
# File 'lib/async/service/supervisor/environment.rb', line 23 def service_class Supervisor::Service end |