Module: Microsandbox::RootDisk
- Defined in:
- lib/microsandbox/root_disk.rb
Overview
Factory for an OCI sandbox's writable root disk spec (runtime v0.6.7),
passed to Sandbox.create via root_disk:. Three kinds:
- RootDisk.managed — the default: a sparse ext4 upper file created and resized by
the runtime (4 GiB cap when no size is given). A bare Integer passed to
root_disk:means the same thing. - RootDisk.tmpfs — RAM-backed upper, so the rootfs is pristine on every boot. Default size is half the sandbox memory; the size must not exceed sandbox memory (no swap in the guest). Cannot be snapshotted or patched.
- RootDisk.disk — a user-supplied disk image attached writable as the upper. The file determines its own size; the runtime never creates, resizes, or deletes it. Cannot be snapshotted or patched.
Mirrors the RootDisk factory in the official Python/Node/Go SDKs.
Class Method Summary collapse
-
.disk(path, format: nil, fstype: nil) ⇒ Hash
A user-supplied disk image attached writable as the upper.
-
.managed(size_mib = nil) ⇒ Hash
The managed sparse-ext4 upper (the default kind).
-
.tmpfs(size_mib = nil) ⇒ Hash
A RAM-backed tmpfs upper — pristine rootfs on every boot.
Class Method Details
.disk(path, format: nil, fstype: nil) ⇒ Hash
A user-supplied disk image attached writable as the upper.
51 52 53 54 55 56 |
# File 'lib/microsandbox/root_disk.rb', line 51 def disk(path, format: nil, fstype: nil) h = {"kind" => "disk", "path" => path.to_s} h["format"] = format.to_s if format h["fstype"] = fstype.to_s if fstype h end |
.managed(size_mib = nil) ⇒ Hash
The managed sparse-ext4 upper (the default kind).
30 31 32 33 34 |
# File 'lib/microsandbox/root_disk.rb', line 30 def managed(size_mib = nil) h = {"kind" => "managed"} h["size_mib"] = Integer(size_mib) if size_mib h end |
.tmpfs(size_mib = nil) ⇒ Hash
A RAM-backed tmpfs upper — pristine rootfs on every boot.
39 40 41 42 43 |
# File 'lib/microsandbox/root_disk.rb', line 39 def tmpfs(size_mib = nil) h = {"kind" => "tmpfs"} h["size_mib"] = Integer(size_mib) if size_mib h end |