Stream: general

Topic: Supporting nested / concurrent client calls


view this post on Zulip James (Jul 27 2023 at 06:26):

Does wasmtime plan to support nested calls and concurrent calls to multiple instance?

Some use case: Client pass callback functions to host function that will be invoked immediately. Like:
Client:

let list = [1, 2, 3];
host_sort_fn(list, callback_to_id(|a, b| a > b));

Host:

fn host_sort_fn(list: Vec<i32>, callback_id: i32) {
  let func = instance.get_func(&mut store, "invoke_callback");
  list.sort_by(|a, b| func.call(&mut store, (callback_id, a, b)));
  // ...
}

view this post on Zulip Lann Martin (Jul 27 2023 at 13:33):

Concurrent Call

If two instances can interact with each other, then they can't safely be called concurrently (in general). If the instances cannot interact then they probably don't need to use the same Store

view this post on Zulip Alex Crichton (Jul 27 2023 at 17:08):

Nested calls are supported though because host functions get access to a Caller which can be used as the store argument

view this post on Zulip James (Jul 28 2023 at 06:45):

Alex Crichton said:

Nested calls are supported though because host functions get access to a Caller which can be used as the store argument

You're right. But if I'm not wrong we can't do that with component model now. At least the trait generated by the bindgen only give access to the store data.


Last updated: Oct 23 2024 at 20:03 UTC