Skip to content

Commit

Permalink
chore: Release
Browse files Browse the repository at this point in the history
  • Loading branch information
yang20150702 committed Jul 8, 2024
1 parent 5c87b71 commit 2b94961
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 43 deletions.
2 changes: 1 addition & 1 deletion dubbo-build/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dubbo-build"
version = "0.3.0"
version = "0.4.0"
edition = "2021"
license = "Apache-2.0"
description = "dubbo-build"
Expand Down
2 changes: 1 addition & 1 deletion dubbo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dubbo"
version = "0.3.0"
version = "0.4.0"
edition = "2021"
license = "Apache-2.0"
description = "dubbo"
Expand Down
2 changes: 1 addition & 1 deletion examples/echo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ dubbo = {path = "../../dubbo"}
dubbo-registry-zookeeper = {path="../../registry/zookeeper"}

[build-dependencies]
dubbo-build = {path = "../../dubbo-build", version = "0.3.0" }
dubbo-build = {path = "../../dubbo-build", version = "0.4.0" }
127 changes: 90 additions & 37 deletions examples/echo/src/generated/grpc.examples.echo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ pub mod echo_client {
let invocation = RpcInvocation::default()
.with_service_unique_name(String::from("grpc.examples.echo.Echo"))
.with_method_name(String::from("UnaryEcho"));
let path = http::uri::PathAndQuery::from_static("/grpc.examples.echo.Echo/UnaryEcho");
let path = http::uri::PathAndQuery::from_static(
"/grpc.examples.echo.Echo/UnaryEcho",
);
self.inner.unary(request, path, invocation).await
}
/// ServerStreamingEcho is server side streaming.
Expand Down Expand Up @@ -100,7 +102,9 @@ pub mod echo_server {
request: Request<super::EchoRequest>,
) -> Result<Response<super::EchoResponse>, dubbo::status::Status>;
///Server streaming response type for the ServerStreamingEcho method.
type ServerStreamingEchoStream: futures_util::Stream<Item = Result<super::EchoResponse, dubbo::status::Status>>
type ServerStreamingEchoStream: futures_util::Stream<
Item = Result<super::EchoResponse, dubbo::status::Status>,
>
+ Send
+ 'static;
/// ServerStreamingEcho is server side streaming.
Expand All @@ -114,14 +118,19 @@ pub mod echo_server {
request: Request<Decoding<super::EchoRequest>>,
) -> Result<Response<super::EchoResponse>, dubbo::status::Status>;
///Server streaming response type for the BidirectionalStreamingEcho method.
type BidirectionalStreamingEchoStream: futures_util::Stream<Item = Result<super::EchoResponse, dubbo::status::Status>>
type BidirectionalStreamingEchoStream: futures_util::Stream<
Item = Result<super::EchoResponse, dubbo::status::Status>,
>
+ Send
+ 'static;
/// BidirectionalStreamingEcho is bidi streaming.
async fn bidirectional_streaming_echo(
&self,
request: Request<Decoding<super::EchoRequest>>,
) -> Result<Response<Self::BidirectionalStreamingEchoStream>, dubbo::status::Status>;
) -> Result<
Response<Self::BidirectionalStreamingEchoStream>,
dubbo::status::Status,
>;
}
/// Echo is the echo service.
#[derive(Debug)]
Expand Down Expand Up @@ -151,7 +160,10 @@ pub mod echo_server {
type Response = http::Response<BoxBody>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
Expand All @@ -164,16 +176,24 @@ pub mod echo_server {
}
impl<T: Echo> UnarySvc<super::EchoRequest> for UnaryEchoServer<T> {
type Response = super::EchoResponse;
type Future = BoxFuture<Response<Self::Response>, dubbo::status::Status>;
fn call(&mut self, request: Request<super::EchoRequest>) -> Self::Future {
type Future = BoxFuture<
Response<Self::Response>,
dubbo::status::Status,
>;
fn call(
&mut self,
request: Request<super::EchoRequest>,
) -> Self::Future {
let inner = self.inner.0.clone();
let fut = async move { inner.unary_echo(request).await };
Box::pin(fut)
}
}
let fut = async move {
let mut server =
TripleServer::<super::EchoRequest, super::EchoResponse>::new();
let mut server = TripleServer::<
super::EchoRequest,
super::EchoResponse,
>::new();
let res = server.unary(UnaryEchoServer { inner }, req).await;
Ok(res)
};
Expand All @@ -184,20 +204,30 @@ pub mod echo_server {
struct ServerStreamingEchoServer<T: Echo> {
inner: _Inner<T>,
}
impl<T: Echo> ServerStreamingSvc<super::EchoRequest> for ServerStreamingEchoServer<T> {
impl<T: Echo> ServerStreamingSvc<super::EchoRequest>
for ServerStreamingEchoServer<T> {
type Response = super::EchoResponse;
type ResponseStream = T::ServerStreamingEchoStream;
type Future =
BoxFuture<Response<Self::ResponseStream>, dubbo::status::Status>;
fn call(&mut self, request: Request<super::EchoRequest>) -> Self::Future {
type Future = BoxFuture<
Response<Self::ResponseStream>,
dubbo::status::Status,
>;
fn call(
&mut self,
request: Request<super::EchoRequest>,
) -> Self::Future {
let inner = self.inner.0.clone();
let fut = async move { inner.server_streaming_echo(request).await };
let fut = async move {
inner.server_streaming_echo(request).await
};
Box::pin(fut)
}
}
let fut = async move {
let mut server =
TripleServer::<super::EchoRequest, super::EchoResponse>::new();
let mut server = TripleServer::<
super::EchoRequest,
super::EchoResponse,
>::new();
let res = server
.server_streaming(ServerStreamingEchoServer { inner }, req)
.await;
Expand All @@ -210,21 +240,29 @@ pub mod echo_server {
struct ClientStreamingEchoServer<T: Echo> {
inner: _Inner<T>,
}
impl<T: Echo> ClientStreamingSvc<super::EchoRequest> for ClientStreamingEchoServer<T> {
impl<T: Echo> ClientStreamingSvc<super::EchoRequest>
for ClientStreamingEchoServer<T> {
type Response = super::EchoResponse;
type Future = BoxFuture<Response<Self::Response>, dubbo::status::Status>;
type Future = BoxFuture<
Response<Self::Response>,
dubbo::status::Status,
>;
fn call(
&mut self,
request: Request<Decoding<super::EchoRequest>>,
) -> Self::Future {
let inner = self.inner.0.clone();
let fut = async move { inner.client_streaming_echo(request).await };
let fut = async move {
inner.client_streaming_echo(request).await
};
Box::pin(fut)
}
}
let fut = async move {
let mut server =
TripleServer::<super::EchoRequest, super::EchoResponse>::new();
let mut server = TripleServer::<
super::EchoRequest,
super::EchoResponse,
>::new();
let res = server
.client_streaming(ClientStreamingEchoServer { inner }, req)
.await;
Expand All @@ -237,39 +275,54 @@ pub mod echo_server {
struct BidirectionalStreamingEchoServer<T: Echo> {
inner: _Inner<T>,
}
impl<T: Echo> StreamingSvc<super::EchoRequest> for BidirectionalStreamingEchoServer<T> {
impl<T: Echo> StreamingSvc<super::EchoRequest>
for BidirectionalStreamingEchoServer<T> {
type Response = super::EchoResponse;
type ResponseStream = T::BidirectionalStreamingEchoStream;
type Future =
BoxFuture<Response<Self::ResponseStream>, dubbo::status::Status>;
type Future = BoxFuture<
Response<Self::ResponseStream>,
dubbo::status::Status,
>;
fn call(
&mut self,
request: Request<Decoding<super::EchoRequest>>,
) -> Self::Future {
let inner = self.inner.0.clone();
let fut =
async move { inner.bidirectional_streaming_echo(request).await };
let fut = async move {
inner.bidirectional_streaming_echo(request).await
};
Box::pin(fut)
}
}
let fut = async move {
let mut server =
TripleServer::<super::EchoRequest, super::EchoResponse>::new();
let mut server = TripleServer::<
super::EchoRequest,
super::EchoResponse,
>::new();
let res = server
.bidi_streaming(BidirectionalStreamingEchoServer { inner }, req)
.bidi_streaming(
BidirectionalStreamingEchoServer {
inner,
},
req,
)
.await;
Ok(res)
};
Box::pin(fut)
}
_ => Box::pin(async move {
Ok(http::Response::builder()
.status(200)
.header("grpc-status", "12")
.header("content-type", "application/grpc")
.body(empty_body())
.unwrap())
}),
_ => {
Box::pin(async move {
Ok(
http::Response::builder()
.status(200)
.header("grpc-status", "12")
.header("content-type", "application/grpc")
.body(empty_body())
.unwrap(),
)
})
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/greeter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ dubbo-registry-zookeeper = {path="../../registry/zookeeper"}
dubbo-registry-nacos = {path="../../registry/nacos"}

[build-dependencies]
dubbo-build = { path = "../../dubbo-build", version = "0.3.0" }
dubbo-build = { path = "../../dubbo-build", version = "0.4.0" }
2 changes: 1 addition & 1 deletion registry/nacos/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dubbo-registry-nacos"
version = "0.3.0"
version = "0.4.0"
edition = "2021"
license = "Apache-2.0"
description = "dubbo-rust-registry-nacos"
Expand Down
2 changes: 1 addition & 1 deletion registry/zookeeper/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dubbo-registry-zookeeper"
version = "0.3.0"
version = "0.4.0"
edition = "2021"
license = "Apache-2.0"
description = "dubbo-rust-registry-zookeeper"
Expand Down

0 comments on commit 2b94961

Please sign in to comment.