Add explicit context_id parameter to all hostcalls. - #92
Conversation
While there, add and consistently use `UNKNOWN_RESOURCE_ID` error for when resources are accessed using an unknown ID. Signed-off-by: Piotr Sikora <code@piotrsikora.dev>
Signed-off-by: Piotr Sikora <code@piotrsikora.dev>
leonm1
left a comment
There was a problem hiding this comment.
My understanding now is that the wasm code itself tells the host which context to use via the context_id parameter. Previously, it was implicit based on the last wasm callback the host invoked.
The context id is given to the wasm code during proxy_on_context_create, then is it the responsibility of the SDK to keep track of it, or is it on plugin authors? It would be helpful guidance to explain this in the description. Can you expand the PR description a bit to express what is changing with this spec change?
Correct (ignoring the
Technically, they don't have to be tracked at all, since all callbacks already include resource ID ( Having said that, I assume that SDKs would provide objects that track the resource IDs and won't require users to operate directly on them. As for the guidance, is a bit tricky, because ABI defines Host<>Wasm interface, and whatever happens on the Wasm side is not part of that contract. The plugin authors may or may not use any SDK at all. We could provide some guidance for the host implementations, but I think anything for the SDK users should be documented in the SDKs, since it may vary from SDK to SDK. |
Signed-off-by: Piotr Sikora <code@piotrsikora.dev>
Signed-off-by: Piotr Sikora <code@piotrsikora.dev>
Signed-off-by: Piotr Sikora <code@piotrsikora.dev>
leonm1
left a comment
There was a problem hiding this comment.
Approved, with a few questions on hostcalls without context_id parameters.
Signed-off-by: Piotr Sikora <code@piotrsikora.dev>
While there, add and consistently use
UNKNOWN_RESOURCE_IDerrorfor when resources are accessed using an unknown ID.