microsandbox-rb 0.5.9 → 0.5.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/sig/microsandbox.rbs CHANGED
@@ -9,8 +9,13 @@ module Microsandbox
9
9
  def self.ensure_runtime!: () -> nil
10
10
  def self.runtime_path: () -> String
11
11
  def self.runtime_path=: (String path) -> void
12
+ def self.libkrunfw_path=: (String path) -> void
12
13
  def self.all_sandbox_metrics: () -> Hash[String, Metrics]
13
14
 
15
+ def self.set_default_backend: (String | Symbol kind, ?url: String?, ?api_key: String?, ?profile: String?) -> void
16
+ def self.with_backend: [T] (String | Symbol kind, ?url: String?, ?api_key: String?, ?profile: String?) { () -> T } -> T
17
+ def self.default_backend_kind: () -> Symbol
18
+
14
19
  class Error < StandardError
15
20
  def self.code: () -> String
16
21
  def code: () -> String
@@ -37,6 +42,8 @@ module Microsandbox
37
42
  class MetricsDisabledError < Error end
38
43
  class MetricsUnavailableError < Error end
39
44
  class UnsupportedOperationError < Error end
45
+ class CloudHttpError < Error end
46
+ class UnsupportedError < Error end
40
47
 
41
48
  class ExecOutput
42
49
  def initialize: (Hash[String, untyped] data) -> void
@@ -114,15 +121,26 @@ module Microsandbox
114
121
  def timestamp: () -> Time
115
122
  end
116
123
 
117
- class SandboxInfo
124
+ class SandboxHandle
118
125
  def name: () -> String
119
126
  def status: () -> Symbol
120
127
  def running?: () -> bool
121
128
  def stopped?: () -> bool
122
129
  def created_at: () -> Time?
123
130
  def updated_at: () -> Time?
131
+ def stop: () -> nil
132
+ def stop_with_timeout: (Numeric timeout) -> nil
133
+ def kill: () -> nil
134
+ def kill_with_timeout: (Numeric timeout) -> nil
135
+ def request_stop: () -> nil
136
+ def request_kill: () -> nil
137
+ def request_drain: () -> nil
138
+ def wait_until_stopped: () -> SandboxStopResult
124
139
  end
125
140
 
141
+ # Deprecated alias for SandboxHandle (was a read-only metadata type pre-v0.5.8).
142
+ SandboxInfo: singleton(SandboxHandle)
143
+
126
144
  class SandboxStopResult
127
145
  def name: () -> String
128
146
  def status: () -> Symbol
@@ -151,9 +169,9 @@ module Microsandbox
151
169
  ?replace: bool, ?replace_with_timeout: Numeric?)
152
170
  ?{ (Sandbox) -> untyped } -> untyped
153
171
  def self.start: (String name, ?detached: bool) -> Sandbox
154
- def self.get: (String name) -> SandboxInfo
155
- def self.list: () -> Array[SandboxInfo]
156
- def self.list_with: (?labels: Hash[untyped, untyped]) -> Array[SandboxInfo]
172
+ def self.get: (String name) -> SandboxHandle
173
+ def self.list: () -> Array[SandboxHandle]
174
+ def self.list_with: (?labels: Hash[untyped, untyped]) -> Array[SandboxHandle]
157
175
  def self.remove: (String name) -> nil
158
176
 
159
177
  def name: () -> String
@@ -163,10 +181,10 @@ module Microsandbox
163
181
  def shell: (String script, ?cwd: String?, ?user: String?, ?env: Hash[untyped, untyped]?,
164
182
  ?timeout: Numeric?, ?tty: bool, ?stdin: String?, ?rlimits: Hash[untyped, untyped]?) -> ExecOutput
165
183
  def exec_stream: (String command, ?Array[String] args, ?cwd: String?, ?user: String?,
166
- ?env: Hash[untyped, untyped]?, ?timeout: Numeric?, ?tty: bool, ?stdin: String?,
184
+ ?env: Hash[untyped, untyped]?, ?timeout: Numeric?, ?tty: bool, ?stdin: (String | :pipe)?,
167
185
  ?rlimits: Hash[untyped, untyped]?) -> ExecHandle
168
186
  def shell_stream: (String script, ?cwd: String?, ?user: String?, ?env: Hash[untyped, untyped]?,
169
- ?timeout: Numeric?, ?tty: bool, ?stdin: String?, ?rlimits: Hash[untyped, untyped]?) -> ExecHandle
187
+ ?timeout: Numeric?, ?tty: bool, ?stdin: (String | :pipe)?, ?rlimits: Hash[untyped, untyped]?) -> ExecHandle
170
188
  def attach: (String command, ?Array[String] args, ?cwd: String?, ?user: String?,
171
189
  ?env: Hash[untyped, untyped]?, ?detach_keys: String?,
172
190
  ?rlimits: Hash[untyped, untyped]?) -> Integer
@@ -179,12 +197,12 @@ module Microsandbox
179
197
  def metrics_stream: (?interval: Numeric) -> MetricsStream
180
198
  def log_stream: (?sources: Array[String | Symbol]?, ?since_ms: Numeric?,
181
199
  ?from_cursor: String?, ?until_ms: Numeric?, ?follow: bool) -> LogStream
182
- def stop: (?timeout: Numeric?) -> nil
183
- def kill: (?timeout: Numeric?) -> nil
184
- def request_stop: () -> nil
185
- def request_kill: () -> nil
186
- def request_drain: () -> nil
187
- def wait_until_stopped: () -> SandboxStopResult
200
+ def stop: () -> nil
201
+ def stop_and_wait: () -> ExitStatus
202
+ def kill: () -> nil
203
+ def drain: () -> nil
204
+ def wait: () -> ExitStatus
205
+ def status: () -> Symbol
188
206
  def owns_lifecycle?: () -> bool
189
207
  def detach: () -> nil
190
208
  end
@@ -216,7 +234,7 @@ module Microsandbox
216
234
  end
217
235
 
218
236
  class ExitStatus
219
- def exit_code: () -> Integer
237
+ def exit_code: () -> Integer?
220
238
  def success?: () -> bool
221
239
  def failure?: () -> bool
222
240
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: microsandbox-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.9
4
+ version: 0.5.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - ya-luotao
@@ -46,6 +46,7 @@ files:
46
46
  - ext/microsandbox/Cargo.toml
47
47
  - ext/microsandbox/extconf.rb
48
48
  - ext/microsandbox/src/agent.rs
49
+ - ext/microsandbox/src/backend.rs
49
50
  - ext/microsandbox/src/conv.rs
50
51
  - ext/microsandbox/src/error.rs
51
52
  - ext/microsandbox/src/exec.rs