microsandbox-rb 0.12.0 → 0.14.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 +152 -1
- data/Cargo.lock +1035 -731
- data/DESIGN.md +107 -18
- data/README.md +124 -16
- data/ext/microsandbox/Cargo.toml +23 -7
- data/ext/microsandbox/src/backend.rs +22 -0
- data/ext/microsandbox/src/error.rs +4 -0
- data/ext/microsandbox/src/sandbox.rs +198 -9
- data/ext/microsandbox/src/snapshot.rs +10 -3
- data/ext/microsandbox/src/volume.rs +9 -0
- data/lib/microsandbox/backend_info.rb +46 -0
- data/lib/microsandbox/errors.rb +4 -0
- data/lib/microsandbox/root_disk.rb +24 -0
- data/lib/microsandbox/sandbox.rb +181 -9
- 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 +144 -13
- data/sig/microsandbox.rbs +29 -2
- 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
|
|
@@ -180,6 +182,7 @@ module Microsandbox
|
|
|
180
182
|
def ping: () -> PingResult
|
|
181
183
|
def touch: () -> TouchResult
|
|
182
184
|
def modify: (?cpus: Integer?, ?max_cpus: Integer?, ?memory: Integer?, ?max_memory: Integer?,
|
|
185
|
+
?root_disk_size: Integer?,
|
|
183
186
|
?env: Hash[untyped, untyped]?, ?remove_env: Array[String]?,
|
|
184
187
|
?labels: Hash[untyped, untyped]?, ?remove_labels: Array[String]?,
|
|
185
188
|
?workdir: String?, ?secrets: Hash[untyped, untyped]?,
|
|
@@ -245,11 +248,14 @@ module Microsandbox
|
|
|
245
248
|
?env: Hash[untyped, untyped]?, ?workdir: String?, ?shell: String?,
|
|
246
249
|
?user: String?, ?hostname: String?, ?labels: Hash[untyped, untyped]?,
|
|
247
250
|
?scripts: Hash[untyped, untyped]?, ?entrypoint: Array[String]?,
|
|
251
|
+
?cmd: Array[String]?,
|
|
248
252
|
?ports: Hash[untyped, untyped]?, ?ports_udp: Hash[untyped, untyped]?,
|
|
249
253
|
?volumes: Hash[untyped, untyped]?, ?network: untyped?,
|
|
250
254
|
?dns: Hash[untyped, untyped]?, ?tls: Hash[untyped, untyped]?,
|
|
251
255
|
?ipv4_pool: String?, ?ipv6_pool: String?,
|
|
252
256
|
?max_connections: Integer?, ?trust_host_cas: bool?,
|
|
257
|
+
?rate_limiter: Hash[untyped, untyped]?,
|
|
258
|
+
?vsock: (Hash[untyped, untyped] | Array[Hash[untyped, untyped]])?,
|
|
253
259
|
?patches: Array[Hash[untyped, untyped]]?, ?from_snapshot: String?,
|
|
254
260
|
?fstype: String?, ?init: (String | Symbol | Hash[untyped, untyped])?, ?ephemeral: bool,
|
|
255
261
|
?log_level: (String | Symbol)?, ?quiet_logs: bool, ?security: (String | Symbol)?,
|
|
@@ -282,16 +288,25 @@ module Microsandbox
|
|
|
282
288
|
?rlimits: Hash[untyped, untyped]?) -> ExecHandle
|
|
283
289
|
def shell_stream: (String script, ?cwd: String?, ?user: String?, ?env: Hash[untyped, untyped]?,
|
|
284
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
|
|
285
297
|
def attach: (String command, ?Array[String] args, ?cwd: String?, ?user: String?,
|
|
286
298
|
?env: Hash[untyped, untyped]?, ?detach_keys: String?,
|
|
287
299
|
?rlimits: Hash[untyped, untyped]?) -> Integer
|
|
288
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
|
|
289
303
|
def fs: () -> FS
|
|
290
304
|
def ssh: () -> SshOps
|
|
291
305
|
def metrics: () -> Metrics
|
|
292
306
|
def ping: () -> PingResult
|
|
293
307
|
def touch: () -> TouchResult
|
|
294
308
|
def modify: (?cpus: Integer?, ?max_cpus: Integer?, ?memory: Integer?, ?max_memory: Integer?,
|
|
309
|
+
?root_disk_size: Integer?,
|
|
295
310
|
?env: Hash[untyped, untyped]?, ?remove_env: Array[String]?,
|
|
296
311
|
?labels: Hash[untyped, untyped]?, ?remove_labels: Array[String]?,
|
|
297
312
|
?workdir: String?, ?secrets: Hash[untyped, untyped]?,
|
|
@@ -412,6 +427,7 @@ module Microsandbox
|
|
|
412
427
|
def name: () -> String
|
|
413
428
|
def path: () -> String?
|
|
414
429
|
def kind: () -> Symbol?
|
|
430
|
+
def default?: () -> bool
|
|
415
431
|
def quota_mib: () -> Integer?
|
|
416
432
|
def used_bytes: () -> Integer?
|
|
417
433
|
def capacity_bytes: () -> Integer?
|
|
@@ -441,6 +457,7 @@ module Microsandbox
|
|
|
441
457
|
def self.create: (String name, ?kind: String, ?size_mib: Integer?, ?quota_mib: Integer?,
|
|
442
458
|
?labels: Hash[untyped, untyped]?) -> VolumeInfo
|
|
443
459
|
def self.get: (String name) -> VolumeInfo
|
|
460
|
+
def self.get_default: () -> VolumeInfo
|
|
444
461
|
def self.list: () -> Array[VolumeInfo]
|
|
445
462
|
def self.remove: (String name) -> nil
|
|
446
463
|
def self.fs: (String name) -> VolumeFs
|
|
@@ -475,8 +492,8 @@ module Microsandbox
|
|
|
475
492
|
def digest: () -> String
|
|
476
493
|
def path: () -> String
|
|
477
494
|
def status: () -> Symbol
|
|
478
|
-
def algorithm: () -> String
|
|
479
|
-
def content_digest: () -> String
|
|
495
|
+
def algorithm: () -> String?
|
|
496
|
+
def content_digest: () -> String?
|
|
480
497
|
def verified?: () -> bool
|
|
481
498
|
end
|
|
482
499
|
|
|
@@ -531,6 +548,16 @@ module Microsandbox
|
|
|
531
548
|
def self.managed: (?Integer? size_mib) -> Hash[String, untyped]
|
|
532
549
|
def self.tmpfs: (?Integer? size_mib) -> Hash[String, untyped]
|
|
533
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
|
|
534
561
|
end
|
|
535
562
|
|
|
536
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.14.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
|