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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +77 -0
- data/Cargo.lock +90 -45
- data/DESIGN.md +7 -3
- data/README.md +91 -26
- data/ext/microsandbox/Cargo.toml +4 -4
- data/ext/microsandbox/extconf.rb +6 -2
- data/ext/microsandbox/src/backend.rs +170 -0
- data/ext/microsandbox/src/error.rs +6 -0
- data/ext/microsandbox/src/image.rs +7 -7
- data/ext/microsandbox/src/lib.rs +27 -4
- data/ext/microsandbox/src/sandbox.rs +172 -58
- data/ext/microsandbox/src/volume.rs +6 -1
- data/lib/microsandbox/errors.rb +6 -0
- data/lib/microsandbox/exec_handle.rb +14 -11
- data/lib/microsandbox/fs.rb +7 -7
- data/lib/microsandbox/image.rb +1 -1
- data/lib/microsandbox/network.rb +19 -19
- data/lib/microsandbox/patch.rb +8 -8
- data/lib/microsandbox/sandbox.rb +199 -75
- data/lib/microsandbox/snapshot.rb +2 -2
- data/lib/microsandbox/ssh.rb +2 -2
- data/lib/microsandbox/version.rb +2 -2
- data/lib/microsandbox/volume.rb +3 -3
- data/lib/microsandbox.rb +61 -0
- data/sig/microsandbox.rbs +31 -13
- metadata +2 -1
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
|
|
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) ->
|
|
155
|
-
def self.list: () -> Array[
|
|
156
|
-
def self.list_with: (?labels: Hash[untyped, untyped]) -> Array[
|
|
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: (
|
|
183
|
-
def
|
|
184
|
-
def
|
|
185
|
-
def
|
|
186
|
-
def
|
|
187
|
-
def
|
|
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.
|
|
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
|