Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: a more lightweight approach #149

Open
wants to merge 43 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
8478eb7
move all the things to old
rklaehn Mar 16, 2025
44a8840
new, more low level approach to rpc
rklaehn Mar 16, 2025
3bcdc86
Add first version of the macro crate
rklaehn Mar 16, 2025
1607a02
keep the first example macro free
rklaehn Mar 16, 2025
c28ae8b
WIP macros
rklaehn Mar 16, 2025
97d53a3
WIP macros
rklaehn Mar 16, 2025
37c1144
WIP rename
rklaehn Mar 16, 2025
09a77f1
works!
rklaehn Mar 16, 2025
7cd6c33
fix comments
rklaehn Mar 16, 2025
0bfac3c
one attribute
rklaehn Mar 16, 2025
7567a66
Add more tests and derive example
rklaehn Mar 16, 2025
2b55b7b
rename rpc feature
rklaehn Mar 16, 2025
36d0a81
Minimize deps even more
rklaehn Mar 16, 2025
206daba
enough for today
rklaehn Mar 16, 2025
9b74bec
Fix a dependency
rklaehn Mar 16, 2025
0006ac4
Add compute example
rklaehn Mar 16, 2025
b6ddade
WIP
rklaehn Mar 16, 2025
6bde683
adapt channel size to same value as in old quic-rpc bench
rklaehn Mar 16, 2025
02d7823
rename Msg to WithChannels again
rklaehn Mar 17, 2025
fada3c4
Add the weird stuff to get the feature flags in docs
rklaehn Mar 17, 2025
57ec9a3
Remove old stuff
rklaehn Mar 17, 2025
6b02fc8
Remove some stuff and do the wasm part in a different way
rklaehn Mar 17, 2025
bc25ba8
clippy
rklaehn Mar 17, 2025
aacb6db
disable compile fail tests for now - they have tiny stupid diffs depe…
rklaehn Mar 17, 2025
ce1abd2
try to fix minimal crates
rklaehn Mar 17, 2025
342c253
another minimal crates fix
rklaehn Mar 17, 2025
902277e
increase version number by a lot and fix postcard minimal version
rklaehn Mar 17, 2025
e282b19
fix tokio-util as well
rklaehn Mar 17, 2025
6965776
Don't require derive_more in the macro
rklaehn Mar 17, 2025
d6ecf83
fix features
rklaehn Mar 17, 2025
2f73a82
Fuse the damn oneshot receiver
rklaehn Mar 17, 2025
2250980
Add ability to send if not busy
rklaehn Mar 18, 2025
90195f7
comment
rklaehn Mar 18, 2025
1f6561d
fixes
rklaehn Mar 18, 2025
39b7172
Add generic enum for local/remote
rklaehn Mar 18, 2025
9fd3f35
fix mismatch with blobs
rklaehn Mar 18, 2025
30e28b8
add spans to compute example
rklaehn Mar 20, 2025
f6d5069
Pass though get_parent_span from the WithChannels impl
rklaehn Mar 20, 2025
ec252c0
pub duh!
rklaehn Mar 20, 2025
15249c2
skip the span when debugging
rklaehn Mar 20, 2025
34c4192
Add a way to find out if a sender is rpc
rklaehn Mar 20, 2025
170f57b
Nicer debug, and don't log at warn level for a normal application close
rklaehn Mar 20, 2025
cf8f4fd
fix bug in try_send
rklaehn Mar 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix mismatch with blobs
rklaehn committed Mar 18, 2025
commit 9fd3f350c942115c2e4fbc2e0bbb6d834cccc07b
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ rcgen = { version = "0.13.2", optional = true }
# used in the test utils to generate quinn endpoints
anyhow = { version = "1.0.66", optional = true }
# used in the benches
futures-buffered ={ version = "0.2.11", optional = true }
futures-buffered ={ version = "0.2.9", optional = true }

[dev-dependencies]
tracing-subscriber = { version = "0.3.19", features = ["fmt"] }
34 changes: 22 additions & 12 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![cfg_attr(quicrpc_docsrs, feature(doc_cfg))]
use std::{fmt::Debug, io, marker::PhantomData, ops::Deref};
use std::{fmt::Debug, future::Future, io, marker::PhantomData, ops::Deref};

use channel::none::NoReceiver;
use sealed::Sealed;
@@ -517,20 +517,30 @@ impl<M: Send + Sync + 'static, R, S: Service> ServiceSender<M, R, S> {
}
}

pub async fn request(
pub fn request(
&self,
) -> io::Result<ServiceRequest<&LocalMpscChannel<M, S>, rpc::RemoteRequest<R, S>>> {
match self {
Self::Local(tx, _) => Ok(ServiceRequest::Local(tx)),
) -> impl Future<
Output = io::Result<ServiceRequest<LocalMpscChannel<M, S>, rpc::RemoteRequest<R, S>>>,
> + 'static {
let cloned = match self {
Self::Local(tx, _) => ServiceRequest::Local(tx.clone()),
#[cfg(feature = "rpc")]
#[cfg_attr(quicrpc_docsrs, doc(cfg(feature = "rpc")))]
Self::Remote(endpoint, addr, _) => {
let connection = endpoint
.connect(*addr, "localhost")
.map_err(io::Error::other)?
.await?;
let (send, recv) = connection.open_bi().await?;
Ok(ServiceRequest::Remote(rpc::RemoteRequest::new(send, recv)))
Self::Remote(endpoint, addr, _) => ServiceRequest::Remote((endpoint.clone(), *addr)),
};
async move {
match cloned {
ServiceRequest::Local(tx) => Ok(ServiceRequest::Local(tx.clone())),
#[cfg(feature = "rpc")]
#[cfg_attr(quicrpc_docsrs, doc(cfg(feature = "rpc")))]
ServiceRequest::Remote((endpoint, addr)) => {
let connection = endpoint
.connect(addr, "localhost")
.map_err(io::Error::other)?
.await?;
let (send, recv) = connection.open_bi().await?;
Ok(ServiceRequest::Remote(rpc::RemoteRequest::new(send, recv)))
}
}
}
}