Class: Nonnative::ConfigurationRunner

Inherits:
Object
  • Object
show all
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.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializevoid

Creates a runner configuration with defaults.

Defaults:

  • ‘host`: `“127.0.0.1”`

  • ‘ports`: `[0]`

  • ‘wait`: `0.1`



32
33
34
35
36
# File 'lib/nonnative/configuration_runner.rb', line 32

def initialize
  self.host = '127.0.0.1'
  @ports = [0]
  self.wait = 0.1
end

Instance Attribute Details

#hostString, ...

Returns:

  • (String, nil)

    runner name used for lookup (for example via ‘pool.process_by_name`)

  • (String)

    host to bind/connect to (defaults to ‘“127.0.0.1”`)

  • (Array<Integer>)

    ports to bind/connect to

  • (Numeric)

    wait interval (seconds) used by runners between lifecycle steps



19
20
21
# File 'lib/nonnative/configuration_runner.rb', line 19

def host
  @host
end

#nameString, ...

Returns:

  • (String, nil)

    runner name used for lookup (for example via ‘pool.process_by_name`)

  • (String)

    host to bind/connect to (defaults to ‘“127.0.0.1”`)

  • (Array<Integer>)

    ports to bind/connect to

  • (Numeric)

    wait interval (seconds) used by runners between lifecycle steps



19
20
21
# File 'lib/nonnative/configuration_runner.rb', line 19

def name
  @name
end

#portsArray<Integer>

Returns client-facing ports used for readiness/shutdown checks.

Returns:

  • (Array<Integer>)

    client-facing ports used for readiness/shutdown checks



22
23
24
# File 'lib/nonnative/configuration_runner.rb', line 22

def ports
  @ports
end

#waitString, ...

Returns:

  • (String, nil)

    runner name used for lookup (for example via ‘pool.process_by_name`)

  • (String)

    host to bind/connect to (defaults to ‘“127.0.0.1”`)

  • (Array<Integer>)

    ports to bind/connect to

  • (Numeric)

    wait interval (seconds) used by runners between lifecycle steps



19
20
21
# File 'lib/nonnative/configuration_runner.rb', line 19

def wait
  @wait
end

Instance Method Details

#portInteger

Returns the primary client-facing port.

This preserves a single endpoint for client helpers while the public configuration contract uses #ports.

Returns:

  • (Integer)


51
52
53
# File 'lib/nonnative/configuration_runner.rb', line 51

def port
  ports.first
end