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.
162 163 164 165 166 167 168 169 |
# File 'lib/microsandbox/sandbox.rb', line 162 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.
156 157 158 |
# File 'lib/microsandbox/sandbox.rb', line 156 def exit_code @exit_code end |
#name ⇒ String (readonly)
152 153 154 |
# File 'lib/microsandbox/sandbox.rb', line 152 def name @name end |
#signal ⇒ Integer? (readonly)
Returns terminating signal, when observed from an owned child.
158 159 160 |
# File 'lib/microsandbox/sandbox.rb', line 158 def signal @signal end |
#source ⇒ String? (readonly)
Returns human description of the observation source.
160 161 162 |
# File 'lib/microsandbox/sandbox.rb', line 160 def source @source end |
#status ⇒ Symbol (readonly)
Returns :running, :draining, :paused, :stopped, or :crashed.
154 155 156 |
# File 'lib/microsandbox/sandbox.rb', line 154 def status @status end |
Instance Method Details
#crashed? ⇒ Boolean
172 |
# File 'lib/microsandbox/sandbox.rb', line 172 def crashed? = @status == :crashed |
#inspect ⇒ Object
179 180 181 182 |
# File 'lib/microsandbox/sandbox.rb', line 179 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.
175 176 177 |
# File 'lib/microsandbox/sandbox.rb', line 175 def observed_at Time.at(@observed_at_ms / 1000.0) end |
#stopped? ⇒ Boolean
171 |
# File 'lib/microsandbox/sandbox.rb', line 171 def stopped? = @status == :stopped |