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



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.



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.



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

def ready?
  port.open?
end