diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2024-06-28 16:47:43 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-28 16:47:43 +0200 |
| commit | 7d7848cddcb303a8bdce6dd1431841345e9f6267 (patch) | |
| tree | 3353b66dfc8a18cdea5d006b57f0c05b9e277be1 /zellij-server/src/plugins/plugin_worker.rs | |
| parent | docs(changelog): mouse fix (diff) | |
| download | sl0ppij-7d7848cddcb303a8bdce6dd1431841345e9f6267.tar.gz sl0ppij-7d7848cddcb303a8bdce6dd1431841345e9f6267.tar.xz sl0ppij-7d7848cddcb303a8bdce6dd1431841345e9f6267.zip | |
dependencies: switch from Wasmer to Wasmtime (#3349)
* Remove ForeignFunctionEnv wrapper around PluginEnv
This will enable PluginEnv to be the Store context when migrating to
Wasmtime.
* Pass PluginEnv by value to load_plugin_instance
This will allow removing the Clone impl from PluginEnv when migrating to
Wasmtime as required by the missing Clone impl on Wasmtime's WasiCtx.
* Avoid passing a Store around when an Engine is enough
* Pass PluginEnv to the wasi read/write functions
Wasmtime requires storing the read/write end of the pipe outside of the
WasiCtx. Passing PluginEnv to these functions allows storing them in the
PluginEnv.
* Migrate to Wasmtime
* Switch from wasi-common to wasmtime-wasi
* Reduce verbosity of wasmtime_wasi logs
* Increase startup delay
To wait for all plugins to be compiled.
* Disable some wasmtime features
* Update to Wasmtime 21.0.1
Diffstat (limited to 'zellij-server/src/plugins/plugin_worker.rs')
| -rw-r--r-- | zellij-server/src/plugins/plugin_worker.rs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/zellij-server/src/plugins/plugin_worker.rs b/zellij-server/src/plugins/plugin_worker.rs index ec577102..3b630706 100644 --- a/zellij-server/src/plugins/plugin_worker.rs +++ b/zellij-server/src/plugins/plugin_worker.rs @@ -1,6 +1,6 @@ use crate::plugins::plugin_map::PluginEnv; use crate::plugins::zellij_exports::wasi_write_object; -use wasmer::{Instance, Store}; +use wasmtime::{Instance, Store}; use zellij_utils::async_channel::{unbounded, Receiver, Sender}; use zellij_utils::async_std::task; @@ -13,24 +13,21 @@ pub struct RunningWorker { pub instance: Instance, pub name: String, pub plugin_config: PluginConfig, - pub plugin_env: PluginEnv, - store: Store, + pub store: Store<PluginEnv>, } impl RunningWorker { pub fn new( - store: Store, + store: Store<PluginEnv>, instance: Instance, name: &str, plugin_config: PluginConfig, - plugin_env: PluginEnv, ) -> Self { RunningWorker { store, instance, name: name.into(), plugin_config, - plugin_env, } } pub fn send_message(&mut self, message: String, payload: String) -> Result<()> { @@ -43,12 +40,11 @@ impl RunningWorker { let protobuf_bytes = protobuf_message.encode_to_vec(); let work_function = self .instance - .exports - .get_function(&self.name) + .get_typed_func::<(), ()>(&mut self.store, &self.name) .with_context(err_context)?; - wasi_write_object(&self.plugin_env.wasi_env, &protobuf_bytes).with_context(err_context)?; + wasi_write_object(self.store.data(), &protobuf_bytes).with_context(err_context)?; work_function - .call(&mut self.store, &[]) + .call(&mut self.store, ()) .with_context(err_context)?; Ok(()) } |
