jrandolf opened PR #14918 from jrandolf:wasi-keyvalue-named-imports to bytecodealliance:main:
This builds on #14875, so only the last commit is new here.
Components importing
wasi:keyvalueinterfaces under a label couldn't be linked with wasmtime-wasi-keyvalue. Its bindings are private, so embedders couldn't do it themselves either. This addsadd_named_to_linker, following the named-import support in wasmtime-wasi (#14275).wasmtime-wasi-keyvalue now depends on
wasmtime-wasi(it was a dev-dependency) to share itsNamedId. That grows its dependency tree from 81 to 151 crates, so I'd appreciate a second opinion on whether that's the right way to share it.Part of #14858
<details>
<summary>LLM summary of the changes</summary>API
WasiKeyValueNamedViewmaps aNamedIdto theWasiKeyValuecontext to use.InterfacehasKeyvalueStore,KeyvalueAtomicsandKeyvalueBatch.add_named_to_linkeradds every labelled import ofwasi:keyvalue/{store,atomics,batch}that the component has, askinglookupfor each one's id.Implementation
The bindings get
named_importsfor the three interfaces. Each named method looks up the context for the id and calls the existing implementation. Theconvert_errorconversions take the id because of #14875.Dependency
wasmtime-wasimoves from dev-dependencies to dependencies, forNamedId(ausizenewtype) andWasiCtxNamedView(a one-field wrapper). It's used without default features, but its non-optional dependencies such as tokio still come along.Cargo.lockdoesn't change.Interaction with #14873
#14873 changes the signature of the
add_named_to_linkerlookup. Whichever of the two lands second needs to port this function, which is mechanical.Test
keyvalue_named_importsruns a new guest program with two labelledwasi:keyvalue/storeimports, each backed by its own in-memory data, and checks that the labels get separate contexts.</details>
jrandolf commented on PR #14918:
Closing: nobody needs labelled
wasi:keyvalueimports yet, andwasi:keyvalueisn't part of a WASI release. Happy to revisit if someone asks.
:cross_mark: jrandolf closed without merge PR #14918.
Last updated: Oct 31 2026 at 23:03 UTC