The CLI’s name registry: one owner-only JSON file per name under <stateDir>/names/.
stateDir defaults to the CLI’s — $MICROVM_STATE_DIR, else ~/.microvm/runs — so a
name registered here resolves in microvm exec --name and the reverse.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new NameRegistry(stateDir?: string | null): NameRegistry;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
stateDir? |
string | null |
Returns
Section titled “Returns”NameRegistry
Accessors
Section titled “Accessors”directory
Section titled “directory”Get Signature
Section titled “Get Signature”get directory(): string;The directory holding the name files.
Returns
Section titled “Returns”string
Methods
Section titled “Methods”delete()
Section titled “delete()”delete(name: string): boolean;Removes name, answering whether a record was there.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name |
string |
Returns
Section titled “Returns”boolean
get(name: string): NameRecord | null;The record registered as name, or null. A file that exists but does not parse
throws rather than reading as free.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name |
string |
Returns
Section titled “Returns”NameRecord | null
importRecord()
Section titled “importRecord()”importRecord(record: NameRecord, session: Session): Promise<boolean>;Registers a record this registry didn’t write, once the VM has answered one authenticated request with the record’s token; resolves with whether it refreshed a record of the same VM.
session must be attached with the record’s endpoint and token (Session.attach from
its fields). A name held by another VM, or by an unreadable file, is refused before any
request, and a probe the daemon refuses writes nothing. Core’s names::import, the rule
microvm attach applies.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
record |
NameRecord |
session |
Session |
Returns
Section titled “Returns”Promise<boolean>
list()
Section titled “list()”list(): NameRecord[];Every readable record, sorted by name.
Returns
Section titled “Returns”put(record: NameRecord): void;Writes record under its name, replacing any earlier record, owner-only on Unix.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
record |
NameRecord |
Returns
Section titled “Returns”void
register()
Section titled “register()”register(name: string, sandbox: Sandbox): Promise<NameRecord>;Names the VM sandbox addresses and writes the record; resolves with it.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name |
string |
sandbox |
Sandbox |
Returns
Section titled “Returns”Promise<NameRecord>
releaseByVm()
Section titled “releaseByVm()”releaseByVm(microvmId: string): string[];Removes every name registered to microvmId and returns them — the step after a
terminate, so no name outlives its VM.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
microvmId |
string |
Returns
Section titled “Returns”string[]
Provenance
Section titled “Provenance”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.