Skip to content

Commit b6b26ba

Browse files
committed
feat: switch to new transport abstraction
Signed-off-by: Roman Volosatovs <[email protected]>
1 parent 40f2755 commit b6b26ba

File tree

28 files changed

+2418
-7471
lines changed

28 files changed

+2418
-7471
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "wrpc"
3-
version = "0.3.0"
3+
version = "0.2.0"
44
description = "WebAssembly component-native RPC framework based on WIT"
55

66
authors.workspace = true
@@ -41,7 +41,6 @@ nats = [
4141
"dep:async-nats",
4242
"dep:wrpc-transport-nats",
4343
"wrpc-cli/nats",
44-
"dep:wrpc-transport-nats-legacy", # TODO: Remove
4544
]
4645
quic = ["dep:wrpc-transport-quic"]
4746
wasmtime = ["dep:wrpc-runtime-wasmtime"]
@@ -81,9 +80,6 @@ wrpc-transport-nats = { workspace = true, optional = true }
8180
wrpc-transport-quic = { workspace = true, optional = true }
8281
wrpc-wasmtime-nats-cli = { workspace = true, optional = true }
8382

84-
# TODO: Remove
85-
wrpc-transport-nats-legacy = { workspace = true, optional = true }
86-
8783
[dev-dependencies]
8884
anyhow = { workspace = true }
8985
async-nats = { workspace = true }
@@ -102,9 +98,6 @@ quinn = { workspace = true, features = [
10298
] }
10399
wrpc-cli = { workspace = true }
104100

105-
# TODO: Remove
106-
wrpc-transport-legacy = { workspace = true }
107-
108101
[workspace.dependencies]
109102
anyhow = { version = "1", default-features = false }
110103
async-nats = { version = "0.35", git = "https://github.com/rvolosatovs/nats.rs", branch = "feat/command-sender", default-features = false }
@@ -134,7 +127,7 @@ tower = { version = "0.4", default-features = false }
134127
tracing = { version = "0.1", default-features = false }
135128
tracing-subscriber = { version = "0.3", default-features = false }
136129
url = { version = "2", default-features = false }
137-
wasm-tokio = { version = "0.5.14", default-features = false }
130+
wasm-tokio = { version = "0.5.16", default-features = false }
138131
wasmcloud-component-adapters = { version = "0.9", default-features = false }
139132
wasmparser = { version = "0.208", default-features = false }
140133
wasmtime = { version = "21", default-features = false }
@@ -155,7 +148,3 @@ wrpc-transport = { version = "0.26", path = "./crates/transport", default-featur
155148
wrpc-transport-nats = { version = "0.22", path = "./crates/transport-nats", default-features = false }
156149
wrpc-transport-quic = { version = "0.1", path = "./crates/transport-quic", default-features = false }
157150
wrpc-wasmtime-nats-cli = { version = "0.2", path = "./crates/wasmtime-nats-cli", default-features = false }
158-
159-
# TODO: Remove
160-
wrpc-transport-legacy = { version = "0.24.3", path = "./crates/transport-legacy", default-features = false }
161-
wrpc-transport-nats-legacy = { version = "0.21", path = "./crates/transport-nats-legacy", default-features = false }

crates/runtime-wasmtime/src/lib.rs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use core::pin::{pin, Pin};
88
use std::collections::HashSet;
99
use std::sync::Arc;
1010

11-
use anyhow::{anyhow, bail, Context as _};
11+
use anyhow::{bail, Context as _};
1212
use bytes::{BufMut as _, Bytes, BytesMut};
1313
use futures::future::try_join_all;
1414
use futures::stream::FuturesUnordered;
@@ -29,7 +29,7 @@ use wasmtime::component::{LinkerInstance, ResourceType, Type, Val};
2929
use wasmtime::{AsContextMut, Engine, StoreContextMut};
3030
use wasmtime_wasi::pipe::AsyncReadStream;
3131
use wasmtime_wasi::{InputStream, StreamError, WasiView};
32-
use wrpc_transport::{Index as _, Invocation, Invoke, ListDecoderU8, Session};
32+
use wrpc_transport::{Index as _, Invoke, ListDecoderU8};
3333

3434
pub struct RemoteResource(pub Bytes);
3535

@@ -468,7 +468,7 @@ where
468468
w.write_all(&chunk).await?;
469469
}
470470
Err(StreamError::Closed) => {
471-
w.write_all(&[0x00]).await?
471+
w.write_all(&[0x00]).await?;
472472
}
473473
Err(err) => return Err(err.into()),
474474
}
@@ -494,7 +494,7 @@ where
494494
w.write_all(&chunk).await?;
495495
}
496496
Err(StreamError::Closed) => {
497-
w.write_all(&[0x00]).await?
497+
w.write_all(&[0x00]).await?;
498498
}
499499
Err(err) => return Err(err.into()),
500500
}
@@ -946,11 +946,7 @@ where
946946
.context("failed to encode parameter")?;
947947
deferred.push(enc.deferred);
948948
}
949-
let Invocation {
950-
outgoing,
951-
incoming,
952-
session,
953-
} = store
949+
let (outgoing, incoming) = store
954950
.data()
955951
.client()
956952
.invoke(cx, &instance, &name, buf.freeze(), &[[]])
@@ -985,10 +981,7 @@ where
985981
Ok(())
986982
},
987983
)?;
988-
match session.finish(Ok(())).await? {
989-
Ok(()) => Ok(()),
990-
Err(err) => bail!(anyhow!("{err}").context("session failed")),
991-
}
984+
Ok(())
992985
})
993986
})
994987
}

crates/transport-legacy/Cargo.toml

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)