Skip to content

SizeClass

One of the five documented size classes.

minimumMemoryInMiB selects a class; it does not size a VM. Both numbers are on the class or neither.

get baselineGb(): number;

The figure a GB-second rate multiplies. Always the baseline, never the peak.

number


get baselineMib(): number;

number


get baselineVcpu(): number;

number


get peakGb(): number;

The peak in GB, which is what the guest reports as MemTotal.

number


get peakMib(): number;

number


get peakVcpu(): number;

number

describe(): string;

One line naming both numbers.

string


static all(): SizeClass[];

Every class, smallest first.

SizeClass[]


static defaultClass(): SizeClass;

The platform’s default, 2048 MiB. Not the smallest — a 0.5 GB baseline fixes the guest’s always-present ceiling at 2 GB, which OOM-kills a real test suite, and the guest has no swap.

SizeClass


static fromBaselineMib(mib: number): SizeClass;

The class minimumMemoryInMiB = mib selects, or a refusal (TRAP-10).

Off-table figures are refused rather than snapped to a neighbour: the two plausible readings differ in both memory and rate, and neither has been measured.

Parameter Type
mib number

SizeClass


static fromRequest(cpus?: number | null, memoryMib?: number | null): SizeClass;

The smallest class whose baseline covers a resource request (BIND-14).

cpus in vCPUs and memoryMib in MiB, each a request; undefined or zero is no requirement on that axis, and with none on either the answer is defaultClass(). Chosen by baseline, the billed and always-present figure. Throws ERR_INVALID_ARG naming the largest class when no class covers the request, or for a CPU figure that is not a finite non-negative number.

Parameter Type
cpus? number | null
memoryMib? number | null

SizeClass

This page is generated from bindings/microvms-js/index.d.ts by TypeDoc 0.28.20 and typedoc-plugin-markdown 4.13.1, run from site/scripts/gen-reference.mjs on every pnpm run sync, so an edit made here is overwritten by the next run.

To change the page, change the doc comment in the binding’s Rust source, then regenerate the declarations with mise run dts. mise run dts:check fails when the committed file no longer matches the source.