Class: Microsandbox::SandboxStopResult
- Inherits:
-
Object
- Object
- Microsandbox::SandboxStopResult
- Defined in:
- lib/microsandbox/sandbox.rb
Overview
The terminal observation of a stopped sandbox, returned by Microsandbox::SandboxHandle#wait_until_stopped. Mirrors the official SDKs’ ‘SandboxStopResult`.
Instance Attribute Summary collapse
-
#exit_code ⇒ Integer?
readonly
Process exit code, when observed from an owned child.
- #name ⇒ String readonly
-
#signal ⇒ Integer?
readonly
Terminating signal, when observed from an owned child.
-
#source ⇒ String?
readonly
Human description of the observation source.
-
#status ⇒ Symbol
readonly
:running, :draining, :paused, :stopped, or :crashed.
Instance Method Summary collapse
- #crashed? ⇒ Boolean
-
#initialize(data) ⇒ SandboxStopResult
constructor
A new instance of SandboxStopResult.
- #inspect ⇒ Object
-
#observed_at ⇒ Time
When the stopped state was observed.
- #stopped? ⇒ Boolean
Constructor Details
#initialize(data) ⇒ SandboxStopResult
Returns a new instance of SandboxStopResult.
129 130 131 132 133 134 135 136 |
# File 'lib/microsandbox/sandbox.rb', line 129 def initialize(data) @name = data["name"] @status = data["status"].to_sym @exit_code = data["exit_code"] @signal = data["signal"] @source = data["source"] @observed_at_ms = data["observed_at_ms"] end |
Instance Attribute Details
#exit_code ⇒ Integer? (readonly)
Returns process exit code, when observed from an owned child.
123 124 125 |
# File 'lib/microsandbox/sandbox.rb', line 123 def exit_code @exit_code end |
#name ⇒ String (readonly)
119 120 121 |
# File 'lib/microsandbox/sandbox.rb', line 119 def name @name end |
#signal ⇒ Integer? (readonly)
Returns terminating signal, when observed from an owned child.
125 126 127 |
# File 'lib/microsandbox/sandbox.rb', line 125 def signal @signal end |
#source ⇒ String? (readonly)
Returns human description of the observation source.
127 128 129 |
# File 'lib/microsandbox/sandbox.rb', line 127 def source @source end |
#status ⇒ Symbol (readonly)
Returns :running, :draining, :paused, :stopped, or :crashed.
121 122 123 |
# File 'lib/microsandbox/sandbox.rb', line 121 def status @status end |
Instance Method Details
#crashed? ⇒ Boolean
139 |
# File 'lib/microsandbox/sandbox.rb', line 139 def crashed? = @status == :crashed |
#inspect ⇒ Object
146 147 148 149 |
# File 'lib/microsandbox/sandbox.rb', line 146 def inspect "#<Microsandbox::SandboxStopResult name=#{@name.inspect} status=#{@status}" \ "#{" exit_code=#{@exit_code}" if @exit_code}#{" signal=#{@signal}" if @signal}>" end |
#observed_at ⇒ Time
Returns when the stopped state was observed.
142 143 144 |
# File 'lib/microsandbox/sandbox.rb', line 142 def observed_at Time.at(@observed_at_ms / 1000.0) end |
#stopped? ⇒ Boolean
138 |
# File 'lib/microsandbox/sandbox.rb', line 138 def stopped? = @status == :stopped |