microsandbox-rb 0.11.0 → 0.13.0
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 +126 -0
- data/Cargo.lock +1006 -557
- data/README.md +48 -10
- data/ext/microsandbox/Cargo.toml +4 -4
- data/ext/microsandbox/src/backend.rs +29 -9
- data/ext/microsandbox/src/error.rs +89 -1
- data/ext/microsandbox/src/image.rs +18 -8
- data/ext/microsandbox/src/lib.rs +9 -9
- data/ext/microsandbox/src/sandbox.rs +236 -32
- data/ext/microsandbox/src/snapshot.rs +10 -3
- data/ext/microsandbox/src/volume.rs +14 -3
- data/lib/microsandbox/backend_info.rb +46 -0
- data/lib/microsandbox/errors.rb +16 -0
- data/lib/microsandbox/root_disk.rb +24 -0
- data/lib/microsandbox/sandbox.rb +247 -17
- data/lib/microsandbox/snapshot.rb +12 -8
- data/lib/microsandbox/version.rb +2 -2
- data/lib/microsandbox/volume.rb +16 -0
- data/lib/microsandbox.rb +16 -3
- data/sig/microsandbox.rbs +48 -5
- metadata +2 -1
data/sig/microsandbox.rbs
CHANGED
|
@@ -27,6 +27,7 @@ module Microsandbox
|
|
|
27
27
|
def self.set_default_backend: (String | Symbol kind, ?url: String?, ?api_key: String?, ?profile: String?) -> void
|
|
28
28
|
def self.with_backend: [T] (String | Symbol kind, ?url: String?, ?api_key: String?, ?profile: String?) { () -> T } -> T
|
|
29
29
|
def self.default_backend_kind: () -> Symbol
|
|
30
|
+
def self.default_backend_info: () -> BackendInfo
|
|
30
31
|
|
|
31
32
|
class Error < StandardError
|
|
32
33
|
def self.code: () -> String
|
|
@@ -40,6 +41,7 @@ module Microsandbox
|
|
|
40
41
|
class SandboxStillRunningError < Error end
|
|
41
42
|
class ExecTimeoutError < Error end
|
|
42
43
|
class ExecFailedError < Error end
|
|
44
|
+
class NoDefaultCommandError < Error end
|
|
43
45
|
class FilesystemError < Error end
|
|
44
46
|
class PathNotFoundError < Error end
|
|
45
47
|
class VolumeNotFoundError < Error end
|
|
@@ -61,7 +63,10 @@ module Microsandbox
|
|
|
61
63
|
class MetricsUnavailableError < Error end
|
|
62
64
|
class UnsupportedOperationError < Error end
|
|
63
65
|
class CloudHttpError < Error end
|
|
64
|
-
class UnsupportedError < Error
|
|
66
|
+
class UnsupportedError < Error
|
|
67
|
+
def operation: () -> String?
|
|
68
|
+
def hint: () -> String?
|
|
69
|
+
end
|
|
65
70
|
|
|
66
71
|
class ExecOutput
|
|
67
72
|
def initialize: (Hash[String, untyped] data) -> void
|
|
@@ -177,6 +182,7 @@ module Microsandbox
|
|
|
177
182
|
def ping: () -> PingResult
|
|
178
183
|
def touch: () -> TouchResult
|
|
179
184
|
def modify: (?cpus: Integer?, ?max_cpus: Integer?, ?memory: Integer?, ?max_memory: Integer?,
|
|
185
|
+
?root_disk_size: Integer?,
|
|
180
186
|
?env: Hash[untyped, untyped]?, ?remove_env: Array[String]?,
|
|
181
187
|
?labels: Hash[untyped, untyped]?, ?remove_labels: Array[String]?,
|
|
182
188
|
?workdir: String?, ?secrets: Hash[untyped, untyped]?,
|
|
@@ -198,6 +204,19 @@ module Microsandbox
|
|
|
198
204
|
def observed_at: () -> Time
|
|
199
205
|
end
|
|
200
206
|
|
|
207
|
+
class SandboxPage
|
|
208
|
+
include Enumerable[SandboxHandle]
|
|
209
|
+
def initialize: (Array[SandboxHandle] sandboxes, String? next_cursor) -> void
|
|
210
|
+
def sandboxes: () -> Array[SandboxHandle]
|
|
211
|
+
def next_cursor: () -> String?
|
|
212
|
+
def each: () { (SandboxHandle) -> void } -> Array[SandboxHandle]
|
|
213
|
+
| () -> Enumerator[SandboxHandle, Array[SandboxHandle]]
|
|
214
|
+
def size: () -> Integer
|
|
215
|
+
def length: () -> Integer
|
|
216
|
+
def empty?: () -> bool
|
|
217
|
+
def last_page?: () -> bool
|
|
218
|
+
end
|
|
219
|
+
|
|
201
220
|
class PingResult
|
|
202
221
|
def initialize: (Hash[String, untyped] data) -> void
|
|
203
222
|
def name: () -> String
|
|
@@ -229,11 +248,14 @@ module Microsandbox
|
|
|
229
248
|
?env: Hash[untyped, untyped]?, ?workdir: String?, ?shell: String?,
|
|
230
249
|
?user: String?, ?hostname: String?, ?labels: Hash[untyped, untyped]?,
|
|
231
250
|
?scripts: Hash[untyped, untyped]?, ?entrypoint: Array[String]?,
|
|
251
|
+
?cmd: Array[String]?,
|
|
232
252
|
?ports: Hash[untyped, untyped]?, ?ports_udp: Hash[untyped, untyped]?,
|
|
233
253
|
?volumes: Hash[untyped, untyped]?, ?network: untyped?,
|
|
234
254
|
?dns: Hash[untyped, untyped]?, ?tls: Hash[untyped, untyped]?,
|
|
235
255
|
?ipv4_pool: String?, ?ipv6_pool: String?,
|
|
236
256
|
?max_connections: Integer?, ?trust_host_cas: bool?,
|
|
257
|
+
?rate_limiter: Hash[untyped, untyped]?,
|
|
258
|
+
?vsock: (Hash[untyped, untyped] | Array[Hash[untyped, untyped]])?,
|
|
237
259
|
?patches: Array[Hash[untyped, untyped]]?, ?from_snapshot: String?,
|
|
238
260
|
?fstype: String?, ?init: (String | Symbol | Hash[untyped, untyped])?, ?ephemeral: bool,
|
|
239
261
|
?log_level: (String | Symbol)?, ?quiet_logs: bool, ?security: (String | Symbol)?,
|
|
@@ -251,8 +273,8 @@ module Microsandbox
|
|
|
251
273
|
def self.create_with_progress: (String name, **untyped) -> PullSession
|
|
252
274
|
def self.start: (String name, ?detached: bool) -> Sandbox
|
|
253
275
|
def self.get: (String name) -> SandboxHandle
|
|
254
|
-
def self.list: () ->
|
|
255
|
-
def self.list_with: (?labels: Hash[untyped, untyped]) ->
|
|
276
|
+
def self.list: () -> SandboxPage
|
|
277
|
+
def self.list_with: (?labels: Hash[untyped, untyped], ?limit: Integer?, ?cursor: String?) -> SandboxPage
|
|
256
278
|
def self.remove: (String name) -> nil
|
|
257
279
|
|
|
258
280
|
def name: () -> String
|
|
@@ -266,16 +288,25 @@ module Microsandbox
|
|
|
266
288
|
?rlimits: Hash[untyped, untyped]?) -> ExecHandle
|
|
267
289
|
def shell_stream: (String script, ?cwd: String?, ?user: String?, ?env: Hash[untyped, untyped]?,
|
|
268
290
|
?timeout: Numeric?, ?tty: bool, ?stdin: (String | :pipe | :null)?, ?rlimits: Hash[untyped, untyped]?) -> ExecHandle
|
|
291
|
+
def exec_default: (?cwd: String?, ?user: String?, ?env: Hash[untyped, untyped]?,
|
|
292
|
+
?timeout: Numeric?, ?tty: bool, ?stdin: (String | :null)?,
|
|
293
|
+
?rlimits: Hash[untyped, untyped]?) -> ExecOutput
|
|
294
|
+
def exec_default_stream: (?cwd: String?, ?user: String?, ?env: Hash[untyped, untyped]?,
|
|
295
|
+
?timeout: Numeric?, ?tty: bool, ?stdin: (String | :pipe | :null)?,
|
|
296
|
+
?rlimits: Hash[untyped, untyped]?) -> ExecHandle
|
|
269
297
|
def attach: (String command, ?Array[String] args, ?cwd: String?, ?user: String?,
|
|
270
298
|
?env: Hash[untyped, untyped]?, ?detach_keys: String?,
|
|
271
299
|
?rlimits: Hash[untyped, untyped]?) -> Integer
|
|
272
300
|
def attach_shell: () -> Integer
|
|
301
|
+
def attach_default: (?cwd: String?, ?user: String?, ?env: Hash[untyped, untyped]?,
|
|
302
|
+
?detach_keys: String?, ?rlimits: Hash[untyped, untyped]?) -> Integer
|
|
273
303
|
def fs: () -> FS
|
|
274
304
|
def ssh: () -> SshOps
|
|
275
305
|
def metrics: () -> Metrics
|
|
276
306
|
def ping: () -> PingResult
|
|
277
307
|
def touch: () -> TouchResult
|
|
278
308
|
def modify: (?cpus: Integer?, ?max_cpus: Integer?, ?memory: Integer?, ?max_memory: Integer?,
|
|
309
|
+
?root_disk_size: Integer?,
|
|
279
310
|
?env: Hash[untyped, untyped]?, ?remove_env: Array[String]?,
|
|
280
311
|
?labels: Hash[untyped, untyped]?, ?remove_labels: Array[String]?,
|
|
281
312
|
?workdir: String?, ?secrets: Hash[untyped, untyped]?,
|
|
@@ -396,6 +427,7 @@ module Microsandbox
|
|
|
396
427
|
def name: () -> String
|
|
397
428
|
def path: () -> String?
|
|
398
429
|
def kind: () -> Symbol?
|
|
430
|
+
def default?: () -> bool
|
|
399
431
|
def quota_mib: () -> Integer?
|
|
400
432
|
def used_bytes: () -> Integer?
|
|
401
433
|
def capacity_bytes: () -> Integer?
|
|
@@ -425,6 +457,7 @@ module Microsandbox
|
|
|
425
457
|
def self.create: (String name, ?kind: String, ?size_mib: Integer?, ?quota_mib: Integer?,
|
|
426
458
|
?labels: Hash[untyped, untyped]?) -> VolumeInfo
|
|
427
459
|
def self.get: (String name) -> VolumeInfo
|
|
460
|
+
def self.get_default: () -> VolumeInfo
|
|
428
461
|
def self.list: () -> Array[VolumeInfo]
|
|
429
462
|
def self.remove: (String name) -> nil
|
|
430
463
|
def self.fs: (String name) -> VolumeFs
|
|
@@ -459,8 +492,8 @@ module Microsandbox
|
|
|
459
492
|
def digest: () -> String
|
|
460
493
|
def path: () -> String
|
|
461
494
|
def status: () -> Symbol
|
|
462
|
-
def algorithm: () -> String
|
|
463
|
-
def content_digest: () -> String
|
|
495
|
+
def algorithm: () -> String?
|
|
496
|
+
def content_digest: () -> String?
|
|
464
497
|
def verified?: () -> bool
|
|
465
498
|
end
|
|
466
499
|
|
|
@@ -515,6 +548,16 @@ module Microsandbox
|
|
|
515
548
|
def self.managed: (?Integer? size_mib) -> Hash[String, untyped]
|
|
516
549
|
def self.tmpfs: (?Integer? size_mib) -> Hash[String, untyped]
|
|
517
550
|
def self.disk: (String path, ?format: (String | Symbol)?, ?fstype: String?) -> Hash[String, untyped]
|
|
551
|
+
def self.flat: (?Integer? size_mib, ?fstype: String?, ?clone: (String | Symbol)?) -> Hash[String, untyped]
|
|
552
|
+
end
|
|
553
|
+
|
|
554
|
+
class BackendInfo
|
|
555
|
+
def kind: () -> Symbol
|
|
556
|
+
def api_url: () -> String?
|
|
557
|
+
def source: () -> Symbol
|
|
558
|
+
def profile: () -> String?
|
|
559
|
+
def local?: () -> bool
|
|
560
|
+
def cloud?: () -> bool
|
|
518
561
|
end
|
|
519
562
|
|
|
520
563
|
class NetworkPolicy
|
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.
|
|
4
|
+
version: 0.13.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ya-luotao
|
|
@@ -61,6 +61,7 @@ files:
|
|
|
61
61
|
- ext/microsandbox/src/volume.rs
|
|
62
62
|
- lib/microsandbox.rb
|
|
63
63
|
- lib/microsandbox/agent.rb
|
|
64
|
+
- lib/microsandbox/backend_info.rb
|
|
64
65
|
- lib/microsandbox/errors.rb
|
|
65
66
|
- lib/microsandbox/exec_handle.rb
|
|
66
67
|
- lib/microsandbox/exec_output.rb
|