Class: Microsandbox::PingResult
- Inherits:
-
Object
- Object
- Microsandbox::PingResult
- Defined in:
- lib/microsandbox/modification.rb
Overview
The result of Sandbox#ping / SandboxHandle#ping: a lightweight health
check that confirms the guest agent is reachable without refreshing the
sandbox idle timer. Mirrors the official SDKs' SandboxPingResult.
The native layer reports latency as seconds; #latency is the canonical value and #latency_ms the convenience the Python/Node SDKs expose.
Instance Attribute Summary collapse
-
#latency ⇒ Float
readonly
Round-trip latency in seconds.
-
#name ⇒ String
readonly
The sandbox name that was pinged.
Instance Method Summary collapse
-
#initialize(data) ⇒ PingResult
constructor
A new instance of PingResult.
- #inspect ⇒ Object
-
#latency_ms ⇒ Float
Round-trip latency in milliseconds.
Constructor Details
#initialize(data) ⇒ PingResult
Returns a new instance of PingResult.
16 17 18 19 |
# File 'lib/microsandbox/modification.rb', line 16 def initialize(data) @name = data["name"] @latency = data["latency_secs"] end |
Instance Attribute Details
#latency ⇒ Float (readonly)
Returns round-trip latency in seconds.
14 15 16 |
# File 'lib/microsandbox/modification.rb', line 14 def latency @latency end |
#name ⇒ String (readonly)
Returns the sandbox name that was pinged.
12 13 14 |
# File 'lib/microsandbox/modification.rb', line 12 def name @name end |
Instance Method Details
#inspect ⇒ Object
26 27 28 |
# File 'lib/microsandbox/modification.rb', line 26 def inspect "#<Microsandbox::PingResult name=#{@name.inspect} latency_ms=#{format("%.3f", latency_ms)}>" end |
#latency_ms ⇒ Float
Returns round-trip latency in milliseconds.
22 23 24 |
# File 'lib/microsandbox/modification.rb', line 22 def latency_ms @latency * 1000.0 end |