Class: Nonnative::Ports
- Inherits:
-
Object
- Object
- Nonnative::Ports
- Defined in:
- lib/nonnative/ports.rb
Overview
Performs aggregate readiness and shutdown checks for a configured runner.
A runner is considered ready only when every configured port is open and every configured HTTP/gRPC readiness probe reports ready, and stopped only when every configured port is closed.
Instance Method Summary collapse
-
#closed? ⇒ Boolean
Returns whether all configured ports become non-connectable before their timeouts elapse.
-
#description ⇒ String
Returns endpoint and log context for lifecycle errors.
-
#endpoints ⇒ String
Returns the checked endpoints for lifecycle diagnostics.
-
#initialize(runner) ⇒ Ports
constructor
A new instance of Ports.
-
#open? ⇒ Boolean
Returns whether all configured ports become connectable and all configured HTTP/gRPC readiness probes report ready before their timeouts elapse.
Constructor Details
Instance Method Details
#closed? ⇒ Boolean
Returns whether all configured ports become non-connectable before their timeouts elapse.
29 30 31 |
# File 'lib/nonnative/ports.rb', line 29 def closed? ports.all?(&:closed?) end |
#description ⇒ String
Returns endpoint and log context for lifecycle errors.
43 44 45 46 47 48 49 50 |
# File 'lib/nonnative/ports.rb', line 43 def description details = [] details << "readiness: #{readiness.map(&:endpoint).join(', ')}" if readiness.any? log = runner.log if runner.respond_to?(:log) details << "log: #{log}" if log details.empty? ? endpoints : "#{endpoints} (#{details.join('; ')})" end |
#endpoints ⇒ String
Returns the checked endpoints for lifecycle diagnostics.
36 37 38 |
# File 'lib/nonnative/ports.rb', line 36 def endpoints ports.map(&:endpoint).join(', ') end |
#open? ⇒ Boolean
Returns whether all configured ports become connectable and all configured HTTP/gRPC readiness probes report ready before their timeouts elapse.
22 23 24 |
# File 'lib/nonnative/ports.rb', line 22 def open? ports.all?(&:open?) && readiness.all?(&:ready?) end |