This is an automated email from the ASF dual-hosted git repository.
yangyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/dubbo-rust.git
The following commit(s) were added to refs/heads/main by this push:
new 4771b69 Rft: using subpackage to manage registry implementations for
avoiding root-level directory abuse. (#121)
4771b69 is described below
commit 4771b69320bdfb052773036c60302a5a2a49523f
Author: 墨舟 <[email protected]>
AuthorDate: Tue Feb 28 23:31:52 2023 +0800
Rft: using subpackage to manage registry implementations for avoiding
root-level directory abuse. (#121)
* Rft: using subpackage to manage registry implementations for avoiding
primary directory abuse.
---
Cargo.toml | 11 +-
examples/echo/Cargo.toml | 2 +-
examples/echo/src/generated/grpc.examples.echo.rs | 187 +++++++------------
examples/greeter/Cargo.toml | 2 +-
registry/Cargo.toml | 11 --
registry/LICENSE | 202 ---------------------
{registry-nacos => registry/nacos}/Cargo.toml | 11 +-
{registry-nacos => registry/nacos}/LICENSE | 0
{registry-nacos => registry/nacos}/src/lib.rs | 0
.../nacos}/src/nacos_registry.rs | 2 +-
.../nacos}/src/utils/mod.rs | 0
registry/src/lib.rs | 25 ---
.../zookeeper}/Cargo.toml | 10 +-
{registry-zookeeper => registry/zookeeper}/LICENSE | 0
.../zookeeper}/src/lib.rs | 0
.../zookeeper}/src/zookeeper_registry.rs | 6 +-
16 files changed, 90 insertions(+), 379 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
index d18fab3..ae339cd 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,9 +1,8 @@
[workspace]
members = [
"xds",
- "registry",
- "registry-zookeeper",
- "registry-nacos",
+ "registry/zookeeper",
+ "registry/nacos",
"metadata",
"config",
"dubbo",
@@ -27,4 +26,10 @@ lazy_static = "1"
futures = "0.3"
tracing = "0.1"
tracing-subscriber = "0.3.15"
+serde = "1"
+serde_json = "1"
+urlencoding = "2.1.2"
+logger = {path="./common/logger"}
+anyhow = "1.0.66"
+dubbo = { path = "./dubbo/" }
diff --git a/examples/echo/Cargo.toml b/examples/echo/Cargo.toml
index 82d1554..93ba6d9 100644
--- a/examples/echo/Cargo.toml
+++ b/examples/echo/Cargo.toml
@@ -34,7 +34,7 @@ hyper = { version = "0.14.19", features = ["full"]}
dubbo = {path = "../../dubbo", version = "0.3.0" }
dubbo-config = {path = "../../config", version = "0.3.0" }
-dubbo-registry-zookeeper = {path = "../../registry-zookeeper", version =
"0.3.0" }
+dubbo-registry-zookeeper = {path = "../../registry/zookeeper", version =
"0.3.0" }
[build-dependencies]
dubbo-build = {path = "../../dubbo-build", version = "0.3.0" }
diff --git a/examples/echo/src/generated/grpc.examples.echo.rs
b/examples/echo/src/generated/grpc.examples.echo.rs
index c095ddf..ccb385c 100644
--- a/examples/echo/src/generated/grpc.examples.echo.rs
+++ b/examples/echo/src/generated/grpc.examples.echo.rs
@@ -1,15 +1,15 @@
-// @generated by apache/dubbo-rust.
-
/// EchoRequest is the request for echo.
+#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EchoRequest {
- #[prost(string, tag="1")]
+ #[prost(string, tag = "1")]
pub message: ::prost::alloc::string::String,
}
/// EchoResponse is the response for echo.
+#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EchoResponse {
- #[prost(string, tag="1")]
+ #[prost(string, tag = "1")]
pub message: ::prost::alloc::string::String,
}
/// Generated client implementations.
@@ -40,16 +40,12 @@ pub mod echo_client {
&mut self,
request: Request<super::EchoRequest>,
) -> Result<Response<super::EchoResponse>, dubbo::status::Status> {
- let codec = dubbo::codegen::ProstCodec::<
- super::EchoRequest,
- super::EchoResponse,
- >::default();
+ let codec =
+ dubbo::codegen::ProstCodec::<super::EchoRequest,
super::EchoResponse>::default();
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, codec, path, invocation).await
}
/// ServerStreamingEcho is server side streaming.
@@ -57,51 +53,51 @@ pub mod echo_client {
&mut self,
request: Request<super::EchoRequest>,
) -> Result<Response<Decoding<super::EchoResponse>>,
dubbo::status::Status> {
- let codec = dubbo::codegen::ProstCodec::<
- super::EchoRequest,
- super::EchoResponse,
- >::default();
+ let codec =
+ dubbo::codegen::ProstCodec::<super::EchoRequest,
super::EchoResponse>::default();
let invocation = RpcInvocation::default()
.with_service_unique_name(String::from("grpc.examples.echo.Echo"))
.with_method_name(String::from("ServerStreamingEcho"));
let path = http::uri::PathAndQuery::from_static(
"/grpc.examples.echo.Echo/ServerStreamingEcho",
);
- self.inner.server_streaming(request, codec, path, invocation).await
+ self.inner
+ .server_streaming(request, codec, path, invocation)
+ .await
}
/// ClientStreamingEcho is client side streaming.
pub async fn client_streaming_echo(
&mut self,
request: impl IntoStreamingRequest<Message = super::EchoRequest>,
) -> Result<Response<super::EchoResponse>, dubbo::status::Status> {
- let codec = dubbo::codegen::ProstCodec::<
- super::EchoRequest,
- super::EchoResponse,
- >::default();
+ let codec =
+ dubbo::codegen::ProstCodec::<super::EchoRequest,
super::EchoResponse>::default();
let invocation = RpcInvocation::default()
.with_service_unique_name(String::from("grpc.examples.echo.Echo"))
.with_method_name(String::from("ClientStreamingEcho"));
let path = http::uri::PathAndQuery::from_static(
"/grpc.examples.echo.Echo/ClientStreamingEcho",
);
- self.inner.client_streaming(request, codec, path, invocation).await
+ self.inner
+ .client_streaming(request, codec, path, invocation)
+ .await
}
/// BidirectionalStreamingEcho is bidi streaming.
pub async fn bidirectional_streaming_echo(
&mut self,
request: impl IntoStreamingRequest<Message = super::EchoRequest>,
) -> Result<Response<Decoding<super::EchoResponse>>,
dubbo::status::Status> {
- let codec = dubbo::codegen::ProstCodec::<
- super::EchoRequest,
- super::EchoResponse,
- >::default();
+ let codec =
+ dubbo::codegen::ProstCodec::<super::EchoRequest,
super::EchoResponse>::default();
let invocation = RpcInvocation::default()
.with_service_unique_name(String::from("grpc.examples.echo.Echo"))
.with_method_name(String::from("BidirectionalStreamingEcho"));
let path = http::uri::PathAndQuery::from_static(
"/grpc.examples.echo.Echo/BidirectionalStreamingEcho",
);
- self.inner.bidi_streaming(request, codec, path, invocation).await
+ self.inner
+ .bidi_streaming(request, codec, path, invocation)
+ .await
}
}
}
@@ -118,9 +114,7 @@ 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.
@@ -134,19 +128,14 @@ 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)]
@@ -176,10 +165,7 @@ 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 {
@@ -192,26 +178,18 @@ 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::new(
- dubbo::codegen::ProstCodec::<
- super::EchoResponse,
- super::EchoRequest,
- >::default(),
- );
+ let mut server =
TripleServer::new(dubbo::codegen::ProstCodec::<
+ super::EchoResponse,
+ super::EchoRequest,
+ >::default());
let res = server.unary(UnaryEchoServer { inner },
req).await;
Ok(res)
};
@@ -222,32 +200,22 @@ 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::new(
- dubbo::codegen::ProstCodec::<
- super::EchoResponse,
- super::EchoRequest,
- >::default(),
- );
+ let mut server =
TripleServer::new(dubbo::codegen::ProstCodec::<
+ super::EchoResponse,
+ super::EchoRequest,
+ >::default());
let res = server
.server_streaming(ServerStreamingEchoServer {
inner }, req)
.await;
@@ -260,31 +228,23 @@ 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::new(
- dubbo::codegen::ProstCodec::<
- super::EchoResponse,
- super::EchoRequest,
- >::default(),
- );
+ let mut server =
TripleServer::new(dubbo::codegen::ProstCodec::<
+ super::EchoResponse,
+ super::EchoRequest,
+ >::default());
let res = server
.client_streaming(ClientStreamingEchoServer {
inner }, req)
.await;
@@ -297,56 +257,41 @@ 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::new(
- dubbo::codegen::ProstCodec::<
- super::EchoResponse,
- super::EchoRequest,
- >::default(),
- );
+ let mut server =
TripleServer::new(dubbo::codegen::ProstCodec::<
+ super::EchoResponse,
+ super::EchoRequest,
+ >::default());
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())
+ }),
}
}
}
diff --git a/examples/greeter/Cargo.toml b/examples/greeter/Cargo.toml
index 491f405..0b14d1a 100644
--- a/examples/greeter/Cargo.toml
+++ b/examples/greeter/Cargo.toml
@@ -31,7 +31,7 @@ tokio-stream = "0.1"
logger = {path="../../common/logger"}
dubbo = {path = "../../dubbo", version = "0.3.0" }
dubbo-config = {path = "../../config", version = "0.3.0" }
-dubbo-registry-zookeeper = {path = "../../registry-zookeeper", version =
"0.3.0" }
+dubbo-registry-zookeeper = {path = "../../registry/zookeeper", version =
"0.3.0" }
[build-dependencies]
dubbo-build = {path = "../../dubbo-build", version = "0.3.0" }
diff --git a/registry/Cargo.toml b/registry/Cargo.toml
deleted file mode 100644
index 3325fa8..0000000
--- a/registry/Cargo.toml
+++ /dev/null
@@ -1,11 +0,0 @@
-[package]
-name = "registry"
-version = "0.3.0"
-edition = "2021"
-license = "Apache-2.0"
-description = "dubbo-rust-registry"
-repository = "https://github.com/apache/dubbo-rust.git"
-
-# See more keys and their definitions at
https://doc.rust-lang.org/cargo/reference/manifest.html
-
-[dependencies]
diff --git a/registry/LICENSE b/registry/LICENSE
deleted file mode 100644
index d645695..0000000
--- a/registry/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/registry-nacos/Cargo.toml b/registry/nacos/Cargo.toml
similarity index 73%
rename from registry-nacos/Cargo.toml
rename to registry/nacos/Cargo.toml
index 2a86a45..36a8fd1 100644
--- a/registry-nacos/Cargo.toml
+++ b/registry/nacos/Cargo.toml
@@ -10,11 +10,10 @@ repository = "https://github.com/apache/dubbo-rust.git"
[dependencies]
nacos-sdk = { version = "0.2", features = ["naming", "auth-by-http"] }
-dubbo = {path = "../dubbo/", version = "0.3.0" }
-serde_json = "1.0"
-serde = {version = "1.0.145",features = ["derive"]}
-tracing = "0.1"
-anyhow = "1.0.66"
-
+dubbo.workspace = true
+serde_json.workspace = true
+serde = { workspace = true, features = ["derive"] }
+anyhow.workspace = true
+logger.workspace = true
[dev-dependencies]
tracing-subscriber = "0.3.16"
diff --git a/registry-nacos/LICENSE b/registry/nacos/LICENSE
similarity index 100%
rename from registry-nacos/LICENSE
rename to registry/nacos/LICENSE
diff --git a/registry-nacos/src/lib.rs b/registry/nacos/src/lib.rs
similarity index 100%
rename from registry-nacos/src/lib.rs
rename to registry/nacos/src/lib.rs
diff --git a/registry-nacos/src/nacos_registry.rs
b/registry/nacos/src/nacos_registry.rs
similarity index 99%
rename from registry-nacos/src/nacos_registry.rs
rename to registry/nacos/src/nacos_registry.rs
index 2d0d669..0ec8b40 100644
--- a/registry-nacos/src/nacos_registry.rs
+++ b/registry/nacos/src/nacos_registry.rs
@@ -25,8 +25,8 @@ use dubbo::{
common::url::Url,
registry::{NotifyListener, Registry, RegistryNotifyListener, ServiceEvent},
};
+use logger::tracing::{error, info, warn};
use nacos_sdk::api::naming::{NamingService, NamingServiceBuilder,
ServiceInstance};
-use tracing::{error, info, warn};
use crate::utils::{build_nacos_client_props, is_concrete_str, is_wildcard_str,
match_range};
diff --git a/registry-nacos/src/utils/mod.rs b/registry/nacos/src/utils/mod.rs
similarity index 100%
rename from registry-nacos/src/utils/mod.rs
rename to registry/nacos/src/utils/mod.rs
diff --git a/registry/src/lib.rs b/registry/src/lib.rs
deleted file mode 100644
index 3e01853..0000000
--- a/registry/src/lib.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn it_works() {
- let result = 2 + 2;
- assert_eq!(result, 4);
- }
-}
diff --git a/registry-zookeeper/Cargo.toml b/registry/zookeeper/Cargo.toml
similarity index 68%
rename from registry-zookeeper/Cargo.toml
rename to registry/zookeeper/Cargo.toml
index f83283b..a6687d9 100644
--- a/registry-zookeeper/Cargo.toml
+++ b/registry/zookeeper/Cargo.toml
@@ -10,8 +10,8 @@ repository = "https://github.com/apache/dubbo-rust.git"
[dependencies]
zookeeper = "0.7.0"
-dubbo = {path = "../dubbo/", version = "0.3.0" }
-serde_json = "1.0"
-serde = {version = "1.0.145",features = ["derive"]}
-tracing = "0.1"
-urlencoding = "2.1.2"
+dubbo.workspace = true
+serde_json.workspace = true
+serde = { workspace = true, features = ["derive"] }
+urlencoding.workspace = true
+logger.workspace = true
diff --git a/registry-zookeeper/LICENSE b/registry/zookeeper/LICENSE
similarity index 100%
rename from registry-zookeeper/LICENSE
rename to registry/zookeeper/LICENSE
diff --git a/registry-zookeeper/src/lib.rs b/registry/zookeeper/src/lib.rs
similarity index 100%
rename from registry-zookeeper/src/lib.rs
rename to registry/zookeeper/src/lib.rs
diff --git a/registry-zookeeper/src/zookeeper_registry.rs
b/registry/zookeeper/src/zookeeper_registry.rs
similarity index 99%
rename from registry-zookeeper/src/zookeeper_registry.rs
rename to registry/zookeeper/src/zookeeper_registry.rs
index b31d25c..9f7447b 100644
--- a/registry-zookeeper/src/zookeeper_registry.rs
+++ b/registry/zookeeper/src/zookeeper_registry.rs
@@ -24,8 +24,8 @@ use std::{
time::Duration,
};
+use logger::tracing::{debug, error, info};
use serde::{Deserialize, Serialize};
-use tracing::{error, info};
#[allow(unused_imports)]
use zookeeper::{Acl, CreateMode, WatchedEvent, WatchedEventType, Watcher,
ZooKeeper};
@@ -52,7 +52,7 @@ pub const REGISTRY_GROUP_KEY: &str = "registry.group";
struct LoggingWatcher;
impl Watcher for LoggingWatcher {
fn handle(&self, e: WatchedEvent) {
- println!("{:?}", e)
+ info!("{:?}", e)
}
}
@@ -240,7 +240,7 @@ impl Default for ZookeeperRegistry {
impl Registry for ZookeeperRegistry {
fn register(&mut self, url: Url) -> Result<(), StdError> {
- println!("register url: {}", url);
+ debug!("register url: {}", url);
let zk_path = format!(
"/{}/{}/{}/{}",
DUBBO_KEY,