SmolBox.Runtime.WorkerConfig (SmolBox v0.1.0)

Copy Markdown View Source

Host-approved managed worker, prepared artifacts, and exact profile revisions.

Artifact entries have id, sha256, architecture, and an absolute prepared .smolmachine path on this worker. The operator verifies artifact digests, neutral /bin/true startup, disabled workload restart, and the pinned runtime before registering them. Managed admission compares the server-reported version and checks readiness; the worker API cannot attest artifact contents or isolation.

allocation_floor is a required operator declaration with storage_gb, overlay_gb, and host_overhead_mb. It must cover the largest actual disk templates across this worker's runtime and approved artifacts, and its VMM overhead. SmolVM 1.14.1 only grows disk templates: a smaller API request can still expose a larger guest disk. Admission rejects profiles below these floors. This declaration is not remotely attested or a host filesystem quota.

The initial qualification is explicitly :development; it does not certify hostile multi-tenant host quotas. Requested unsupported hard controls are rejected by SmolBox.Profile. Reachability alone does not qualify a worker.

Summary

Functions

Resolve the worker-local image path for a specification already accepted by supports?/2.

Register a worker's approved artifacts, profiles, and admission capacity.

Check exact profile/artifact approval and allocation floors; this is not a health probe.

Revalidate configuration shape, catalogs and declarations without contacting the worker.

Types

t()

@type t() :: %SmolBox.Runtime.WorkerConfig{
  allocation_floor: %{
    storage_gb: pos_integer(),
    overlay_gb: pos_integer(),
    host_overhead_mb: pos_integer()
  },
  architecture: String.t(),
  artifacts: [map()],
  capacity: SmolBox.Store.capacity(),
  client: SmolBox.Client.t(),
  draining: boolean(),
  platform: :linux | :macos,
  profiles: [SmolBox.Profile.t()],
  qualification: :development,
  runtime_version: String.t()
}

Functions

artifact_path(worker, spec)

@spec artifact_path(t(), SmolBox.ExecutionSpec.t()) :: String.t()

Resolve the worker-local image path for a specification already accepted by supports?/2.

new(options)

@spec new(keyword()) :: {:ok, t()} | {:error, SmolBox.Error.t()}

Register a worker's approved artifacts, profiles, and admission capacity.

Required keyword options:

OptionValue
:clientA validated SmolBox.Client
:platform:linux or :macos; initially qualified hosts are Linux x86_64 and macOS Apple Silicon
:architecture"x86_64" or "aarch64"; macOS requires "aarch64"
:artifacts1–32 maps with exactly string keys "id", "sha256", "architecture", and absolute worker "path" ending in .smolmachine
:profiles1–32 valid SmolBox.Profile values with unique IDs
:capacityAtom-keyed map with :slots, :cpus, :memory_mb, and :disk_gb; each 1–1,048,576
:allocation_floorAtom-keyed map with :storage_gb and :overlay_gb (1–64 each), and :host_overhead_mb (128–16,384)

Optional fields are :runtime_version (only "1.14.1"), :qualification (only :development), and :draining (default false). Artifact IDs must be unique and architectures must match this worker. Construction makes no worker request or remote digest check. Profiles below the floor cannot support execution. See Getting started for a complete configuration.

supports?(worker, spec)

@spec supports?(t(), SmolBox.ExecutionSpec.t()) :: boolean()

Check exact profile/artifact approval and allocation floors; this is not a health probe.

validate(worker)

@spec validate(term()) :: :ok | {:error, SmolBox.Error.t()}

Revalidate configuration shape, catalogs and declarations without contacting the worker.