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.
186 187 188 189 190 191 192 193 |
# File 'lib/microsandbox/sandbox.rb', line 186 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.
180 181 182 |
# File 'lib/microsandbox/sandbox.rb', line 180 def exit_code @exit_code end |
#name ⇒ String (readonly)
176 177 178 |
# File 'lib/microsandbox/sandbox.rb', line 176 def name @name end |
#signal ⇒ Integer? (readonly)
Returns terminating signal, when observed from an owned child.
182 183 184 |
# File 'lib/microsandbox/sandbox.rb', line 182 def signal @signal end |
#source ⇒ String? (readonly)
Returns human description of the observation source.
184 185 186 |
# File 'lib/microsandbox/sandbox.rb', line 184 def source @source end |
#status ⇒ Symbol (readonly)
Returns :running, :draining, :paused, :stopped, or :crashed.
178 179 180 |
# File 'lib/microsandbox/sandbox.rb', line 178 def status @status end |
Instance Method Details
#crashed? ⇒ Boolean
196 |
# File 'lib/microsandbox/sandbox.rb', line 196 def crashed? = @status == :crashed |
#inspect ⇒ Object
203 204 205 206 |
# File 'lib/microsandbox/sandbox.rb', line 203 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.
199 200 201 |
# File 'lib/microsandbox/sandbox.rb', line 199 def observed_at Time.at(@observed_at_ms / 1000.0) end |
#stopped? ⇒ Boolean
195 |
# File 'lib/microsandbox/sandbox.rb', line 195 def stopped? = @status == :stopped |