Skip to content

Commit 690df3d

Browse files
committed
chore: update Wasm deps, bump versions
Signed-off-by: Roman Volosatovs <[email protected]>
1 parent 47e44cf commit 690df3d

File tree

23 files changed

+483
-518
lines changed

23 files changed

+483
-518
lines changed

Cargo.lock

Lines changed: 255 additions & 342 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
description = "WebAssembly component-native RPC framework based on WIT"
33
name = "wrpc"
4-
version = "0.15.0"
4+
version = "0.16.0"
55

66
authors.workspace = true
77
categories.workspace = true
@@ -158,31 +158,31 @@ tracing-subscriber = { version = "0.3", default-features = false }
158158
url = { version = "2" }
159159
uuid = { version = "1", default-features = false }
160160
wasi = { version = "0.14", default-features = false }
161-
wasi-preview1-component-adapter-provider = { version = "34", default-features = false }
161+
wasi-preview1-component-adapter-provider = { version = "38", default-features = false }
162162
wasm-tokio = { version = "0.6", default-features = false }
163-
wasmparser = { version = "0.236", default-features = false }
164-
wasmtime = { version = "33.0.2", default-features = false }
165-
wasmtime-cli-flags = { version = "33.0.2", default-features = false }
166-
wasmtime-wasi = { version = "33.0.2", default-features = false }
167-
wasmtime-wasi-http = { version = "33.0.2", default-features = false }
163+
wasmparser = { version = "0.239", default-features = false }
164+
wasmtime = { version = "38", default-features = false }
165+
wasmtime-cli-flags = { version = "38", default-features = false }
166+
wasmtime-wasi = { version = "38", default-features = false }
167+
wasmtime-wasi-http = { version = "38", default-features = false }
168168
wit-bindgen = { version = "0.45", default-features = false }
169169
wit-bindgen-core = { version = "0.36", default-features = false }
170170
wit-bindgen-wrpc = { version = "0.10", default-features = false, path = "./crates/wit-bindgen" }
171171
wit-bindgen-wrpc-go = { version = "0.12", default-features = false, path = "./crates/wit-bindgen-go" }
172172
wit-bindgen-wrpc-rust = { version = "0.10", default-features = false, path = "./crates/wit-bindgen-rust" }
173173
wit-bindgen-wrpc-rust-macro = { version = "0.10", default-features = false, path = "./crates/wit-bindgen-rust-macro" }
174-
wit-component = { version = "0.230", default-features = false }
174+
wit-component = { version = "0.239", default-features = false }
175175
wit-parser = { version = "0.220", default-features = false }
176-
wrpc-cli = { version = "0.6", path = "./crates/cli", default-features = false }
176+
wrpc-cli = { version = "0.7", path = "./crates/cli", default-features = false }
177177
wrpc-introspect = { version = "0.7", default-features = false, path = "./crates/introspect" }
178-
wrpc-runtime-wasmtime = { version = "0.29", path = "./crates/runtime-wasmtime", default-features = false }
178+
wrpc-runtime-wasmtime = { version = "0.30", path = "./crates/runtime-wasmtime", default-features = false }
179179
wrpc-test = { path = "./crates/test", default-features = false }
180180
wrpc-transport = { version = "0.28.3", path = "./crates/transport", default-features = false }
181-
wrpc-transport-nats = { version = "0.29", path = "./crates/transport-nats", default-features = false }
181+
wrpc-transport-nats = { version = "0.30", path = "./crates/transport-nats", default-features = false }
182182
wrpc-transport-quic = { version = "0.5", path = "./crates/transport-quic", default-features = false }
183183
wrpc-transport-web = { version = "0.2", path = "./crates/transport-web", default-features = false }
184184
wrpc-wasi-keyvalue = { version = "0.1.1", path = "./crates/wasi-keyvalue", default-features = false }
185185
wrpc-wasi-keyvalue-mem = { version = "0.1", path = "./crates/wasi-keyvalue-mem", default-features = false }
186186
wrpc-wasi-keyvalue-redis = { version = "0.1", path = "./crates/wasi-keyvalue-redis", default-features = false }
187-
wrpc-wasmtime-cli = { version = "0.7", path = "./crates/wasmtime-cli", default-features = false }
187+
wrpc-wasmtime-cli = { version = "0.8", path = "./crates/wasmtime-cli", default-features = false }
188188
wtransport = { version = "0.6.1", default-features = false }

benches/bench.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use futures::StreamExt as _;
1414
use tokio::select;
1515
use tokio::sync::oneshot;
1616
use wasmtime::component::{Component, Linker, ResourceTable};
17-
use wasmtime_wasi::p2::{IoView, WasiCtx, WasiCtxBuilder, WasiView};
17+
use wasmtime_wasi::{WasiCtx, WasiCtxBuilder, WasiCtxView, WasiView};
1818

1919
mod ping_bindings_wrpc {
2020
wit_bindgen_wrpc::generate!({
@@ -24,7 +24,7 @@ mod ping_bindings_wrpc {
2424
}
2525
mod ping_bindings_wasmtime {
2626
wasmtime::component::bindgen!({
27-
async: true,
27+
exports: { default: async },
2828
world: "ping-proxy",
2929
path: "benches/wit",
3030
});
@@ -37,7 +37,7 @@ mod greet_bindings_wrpc {
3737
}
3838
mod greet_bindings_wasmtime {
3939
wasmtime::component::bindgen!({
40-
async: true,
40+
exports: { default: async },
4141
world: "greet-proxy",
4242
path: "benches/wit",
4343
});
@@ -71,15 +71,12 @@ struct Ctx {
7171
wasi: WasiCtx,
7272
}
7373

74-
impl IoView for Ctx {
75-
fn table(&mut self) -> &mut ResourceTable {
76-
&mut self.table
77-
}
78-
}
79-
8074
impl WasiView for Ctx {
81-
fn ctx(&mut self) -> &mut WasiCtx {
82-
&mut self.wasi
75+
fn ctx(&mut self) -> WasiCtxView<'_> {
76+
WasiCtxView {
77+
ctx: &mut self.wasi,
78+
table: &mut self.table,
79+
}
8380
}
8481
}
8582

crates/cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "wrpc-cli"
3-
version = "0.6.0"
3+
version = "0.7.0"
44
description = "wRPC CLI utilities"
55

66
authors.workspace = true

crates/runtime-wasmtime/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "wrpc-runtime-wasmtime"
3-
version = "0.29.0"
3+
version = "0.30.0"
44
description = "wRPC wasmtime integration"
55

66
authors.workspace = true

crates/runtime-wasmtime/src/bindings.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@ mod generated {
99
"wrpc:rpc/transport/invocation": crate::rpc::Invocation,
1010
"wrpc:rpc/transport/outgoing-channel": crate::rpc::OutgoingChannel,
1111
},
12-
async: {
13-
only_imports: [
14-
"wrpc:rpc/[email protected]#[static]invocation.finish",
15-
],
12+
imports: {
13+
default: trappable,
14+
"wrpc:rpc/[email protected]/[static]invocation.finish": async | trappable,
1615
},
17-
trappable_imports: true,
1816
require_store_data_send: true,
1917
});
2018

crates/runtime-wasmtime/src/codec.rs

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ use wasmtime::component::types::{Case, Field};
2323
use wasmtime::component::{ResourceType, Type, Val};
2424
use wasmtime::{AsContextMut, StoreContextMut};
2525
use wasmtime_wasi::p2::pipe::AsyncReadStream;
26-
use wasmtime_wasi::p2::{DynInputStream, StreamError, WasiView};
26+
use wasmtime_wasi::p2::{DynInputStream, StreamError};
2727
use wrpc_transport::ListDecoderU8;
2828

2929
use crate::{RemoteResource, WrpcView};
3030

31-
pub struct ValEncoder<'a, T, W> {
31+
pub struct ValEncoder<'a, T: 'static, W> {
3232
pub store: StoreContextMut<'a, T>,
3333
pub ty: &'a Type,
3434
pub resources: &'a [ResourceType],
@@ -120,7 +120,7 @@ where
120120

121121
impl<T, W> Encoder<&Val> for ValEncoder<'_, T, W>
122122
where
123-
T: WasiView + WrpcView,
123+
T: WrpcView,
124124
W: AsyncWrite + wrpc_transport::Index<W> + Sync + Send + 'static,
125125
{
126126
type Error = wasmtime::Error;
@@ -449,7 +449,8 @@ where
449449
let mut stream = self
450450
.store
451451
.data_mut()
452-
.table()
452+
.wrpc()
453+
.table
453454
.delete(stream)
454455
.context("failed to delete input stream")?;
455456
self.deferred = Some(Box::new(|w| {
@@ -478,7 +479,8 @@ where
478479
} else {
479480
self.store
480481
.data_mut()
481-
.table()
482+
.wrpc()
483+
.table
482484
.get_mut(&stream)
483485
.context("failed to get input stream")?;
484486
// NOTE: In order to handle this we'd need to know how many bytes the
@@ -491,7 +493,7 @@ where
491493
let resource = resource
492494
.try_into_resource(&mut self.store)
493495
.context("resource type mismatch")?;
494-
let table = self.store.data_mut().table();
496+
let table = self.store.data_mut().wrpc().table;
495497
if resource.owned() {
496498
let RemoteResource(buf) = table
497499
.delete(resource)
@@ -516,6 +518,8 @@ where
516518
if self
517519
.store
518520
.data_mut()
521+
.wrpc()
522+
.ctx
519523
.shared_resources()
520524
.0
521525
.insert(id, *resource)
@@ -528,6 +532,10 @@ where
528532
bail!("encoding host resources not supported yet")
529533
}
530534
}
535+
536+
(_, Type::Future(..) | Type::Stream(..) | Type::ErrorContext) => {
537+
bail!("async not supported")
538+
}
531539
_ => bail!("value type mismatch"),
532540
}
533541
}
@@ -551,7 +559,7 @@ pub async fn read_value<T, R>(
551559
path: &[usize],
552560
) -> std::io::Result<()>
553561
where
554-
T: WasiView + WrpcView,
562+
T: WrpcView + 'static,
555563
R: AsyncRead + wrpc_transport::Index<R> + Send + Unpin + 'static,
556564
{
557565
match ty {
@@ -796,7 +804,8 @@ where
796804
// which will could potentially break/hang with some transports
797805
let res = store
798806
.data_mut()
799-
.table()
807+
.wrpc()
808+
.table
800809
.push(Box::new(AsyncReadStream::new(
801810
FramedRead::new(r, ListDecoderU8::default())
802811
.into_async_read()
@@ -837,6 +846,8 @@ where
837846
trace!(?id, "lookup shared resource");
838847
let resource = store
839848
.data_mut()
849+
.wrpc()
850+
.ctx
840851
.shared_resources()
841852
.0
842853
.get(&id)
@@ -850,7 +861,7 @@ where
850861
.map_err(|err| std::io::Error::new(std::io::ErrorKind::InvalidInput, err))?;
851862
let mut buf = Vec::with_capacity(n);
852863
r.read_to_end(&mut buf).await?;
853-
let table = store.data_mut().table();
864+
let table = store.data_mut().wrpc().table;
854865
let resource = table
855866
.push(RemoteResource(buf.into()))
856867
.map_err(|err| std::io::Error::new(std::io::ErrorKind::OutOfMemory, err))?;
@@ -861,5 +872,9 @@ where
861872
Ok(())
862873
}
863874
}
875+
Type::Future(..) | Type::Stream(..) | Type::ErrorContext => Err(std::io::Error::new(
876+
std::io::ErrorKind::Unsupported,
877+
"async not supported",
878+
)),
864879
}
865880
}

0 commit comments

Comments
 (0)