Module: Microsandbox
- Defined in:
- lib/microsandbox.rb,
lib/microsandbox/fs.rb,
lib/microsandbox/image.rb,
lib/microsandbox/errors.rb,
lib/microsandbox/volume.rb,
lib/microsandbox/metrics.rb,
lib/microsandbox/sandbox.rb,
lib/microsandbox/streams.rb,
lib/microsandbox/version.rb,
lib/microsandbox/snapshot.rb,
lib/microsandbox/log_entry.rb,
lib/microsandbox/exec_handle.rb,
lib/microsandbox/exec_output.rb
Overview
Microsandbox — lightweight microVM sandboxes for Ruby.
The runtime is embedded directly in the process via a Rust native extension; there is no daemon to install and no server to connect to. Creating a sandbox spawns a real microVM as a child process.
Defined Under Namespace
Classes: Error, ExecEvent, ExecHandle, ExecOutput, ExecStdin, ExitStatus, FS, FsEntry, FsMetadata, Image, ImageDetail, ImageInfo, ImagePruneReport, LogEntry, LogStream, Metrics, MetricsStream, Sandbox, SandboxInfo, SandboxStopResult, Snapshot, SnapshotInfo, SnapshotVerifyReport, Volume, VolumeInfo
Constant Summary collapse
- VERSION =
Gem version. Kept in lock-step with the upstream microsandbox runtime and the official Python/Node/Go SDKs (workspace version in the microsandbox repo).
"0.5.7"
Class Method Summary collapse
-
.all_sandbox_metrics ⇒ Hash{String => Metrics}
Latest resource-usage snapshot for every running sandbox, keyed by name.
-
.install ⇒ nil
Download and install the ‘msb` runtime + `libkrunfw` into `~/.microsandbox` (idempotent).
-
.installed? ⇒ Boolean
Whether the runtime is installed and resolvable.
-
.runtime_path ⇒ String
The resolved path to the ‘msb` runtime binary.
-
.runtime_path=(path) ⇒ void
Override the ‘msb` runtime path (highest-priority SDK tier of the resolver, below only the `MSB_PATH` environment variable).
-
.version ⇒ String
The gem version.
Class Method Details
.all_sandbox_metrics ⇒ Hash{String => Metrics}
Latest resource-usage snapshot for every running sandbox, keyed by name. Mirrors the official ‘all_sandbox_metrics`/`allSandboxMetrics` helpers.
74 75 76 |
# File 'lib/microsandbox.rb', line 74 def all_sandbox_metrics Native.all_sandbox_metrics.transform_values { |m| Metrics.new(m) } end |
.install ⇒ nil
Download and install the ‘msb` runtime + `libkrunfw` into `~/.microsandbox` (idempotent). Usually unnecessary: the native extension provisions the runtime at build time.
48 49 50 51 |
# File 'lib/microsandbox.rb', line 48 def install Native.install nil end |
.installed? ⇒ Boolean
Returns whether the runtime is installed and resolvable.
54 55 56 |
# File 'lib/microsandbox.rb', line 54 def installed? Native.installed? end |
.runtime_path ⇒ String
Returns the resolved path to the ‘msb` runtime binary.
59 60 61 |
# File 'lib/microsandbox.rb', line 59 def runtime_path Native.resolved_msb_path end |
.runtime_path=(path) ⇒ void
This method returns an undefined value.
Override the ‘msb` runtime path (highest-priority SDK tier of the resolver, below only the `MSB_PATH` environment variable).
67 68 69 |
# File 'lib/microsandbox.rb', line 67 def runtime_path=(path) Native.set_runtime_msb_path(path.to_s) end |
.version ⇒ String
Returns the gem version.
40 41 42 |
# File 'lib/microsandbox.rb', line 40 def version VERSION end |