Class: Nonnative::TCPProbe

Inherits:
Object
  • Object
show all
Defined in:
lib/nonnative/tcp_probe.rb

Overview

Probes a TCP readiness endpoint.

Defined Under Namespace

Classes: Target

Instance Method Summary collapse

Constructor Details

#initialize(readiness, timeout:) ⇒ TCPProbe

Returns a new instance of TCPProbe.

Parameters:

  • readiness (#host, #port)

    TCP readiness attributes

  • timeout (Numeric)

    maximum time to wait for the TCP endpoint



10
11
12
# File 'lib/nonnative/tcp_probe.rb', line 10

def initialize(readiness, timeout:)
  @port = Nonnative::Port.new(Target.new(host: readiness.host, timeout:), readiness.port)
end

Instance Method Details

#endpointString

Returns the checked endpoint for lifecycle diagnostics.

Returns:

  • (String)


24
25
26
# File 'lib/nonnative/tcp_probe.rb', line 24

def endpoint
  port.endpoint
end

#ready?Boolean

Returns whether the TCP endpoint becomes connectable before the timeout elapses.

Returns:

  • (Boolean)


17
18
19
# File 'lib/nonnative/tcp_probe.rb', line 17

def ready?
  port.open?
end