Class: Nonnative::ConfigurationRunner
- Inherits:
-
Object
- Object
- Nonnative::ConfigurationRunner
- Defined in:
- lib/nonnative/configuration_runner.rb
Overview
Base configuration for a runnable unit managed by Nonnative.
This class holds connection and timing attributes common to processes, servers and services.
Instances of this type are typically created via Nonnative::Configuration#process, Nonnative::Configuration#server, or Nonnative::Configuration#service.
Direct Known Subclasses
ConfigurationProcess, ConfigurationServer, ConfigurationService
Constant Summary collapse
- DEFAULT_TIMEOUT =
Default bounded readiness/shutdown timeout for process and server runners.
1.0
Instance Attribute Summary collapse
-
#host ⇒ String
Host to bind/connect to (defaults to ‘“127.0.0.1”`).
-
#name ⇒ String?
Runner name used for lookup (for example via ‘pool.process_by_name`).
-
#ports ⇒ Array<Integer>
Client-facing ports used for readiness/shutdown checks.
-
#wait ⇒ Numeric
Wait interval (seconds) used by runners between lifecycle steps.
Instance Method Summary collapse
-
#initialize ⇒ void
constructor
Creates a runner configuration with defaults.
-
#port ⇒ Integer
Returns the primary client-facing port.
Constructor Details
#initialize ⇒ void
Creates a runner configuration with defaults.
Defaults:
-
‘host`: `“127.0.0.1”`
-
‘ports`: `[0]`
-
‘wait`: `0.1`
38 39 40 41 42 |
# File 'lib/nonnative/configuration_runner.rb', line 38 def initialize self.host = '127.0.0.1' @ports = [0] self.wait = 0.1 end |
Instance Attribute Details
#host ⇒ String
Returns host to bind/connect to (defaults to ‘“127.0.0.1”`).
22 23 24 |
# File 'lib/nonnative/configuration_runner.rb', line 22 def host @host end |
#name ⇒ String?
Returns runner name used for lookup (for example via ‘pool.process_by_name`).
19 20 21 |
# File 'lib/nonnative/configuration_runner.rb', line 19 def name @name end |
#ports ⇒ Array<Integer>
Returns client-facing ports used for readiness/shutdown checks.
28 29 30 |
# File 'lib/nonnative/configuration_runner.rb', line 28 def ports @ports end |
#wait ⇒ Numeric
Returns wait interval (seconds) used by runners between lifecycle steps.
25 26 27 |
# File 'lib/nonnative/configuration_runner.rb', line 25 def wait @wait end |
Instance Method Details
#port ⇒ Integer
Returns the primary client-facing port.
This preserves a single endpoint for client helpers while the public configuration contract uses #ports.
57 58 59 |
# File 'lib/nonnative/configuration_runner.rb', line 57 def port ports.first end |