From 666e32a7babff0b65658c9f5f1e445af466426cd Mon Sep 17 00:00:00 2001 From: Yang Yang <962032265q@gmail.com> Date: Tue, 28 Feb 2023 23:35:25 +0800 Subject: [PATCH] Revert "Rft: using subpackage to manage registry implementations for avoiding root-level directory abuse. (#121)" This reverts commit 4771b69320bdfb052773036c60302a5a2a49523f. --- Cargo.toml | 11 +- examples/echo/Cargo.toml | 2 +- .../echo/src/generated/grpc.examples.echo.rs | 187 ++++++++++------ examples/greeter/Cargo.toml | 2 +- {registry/nacos => registry-nacos}/Cargo.toml | 11 +- {registry/nacos => registry-nacos}/LICENSE | 0 {registry/nacos => registry-nacos}/src/lib.rs | 0 .../src/nacos_registry.rs | 2 +- .../nacos => registry-nacos}/src/utils/mod.rs | 0 .../Cargo.toml | 10 +- .../zookeeper => registry-zookeeper}/LICENSE | 0 .../src/lib.rs | 0 .../src/zookeeper_registry.rs | 6 +- registry/Cargo.toml | 11 + registry/LICENSE | 202 ++++++++++++++++++ registry/src/lib.rs | 25 +++ 16 files changed, 379 insertions(+), 90 deletions(-) rename {registry/nacos => registry-nacos}/Cargo.toml (73%) rename {registry/nacos => registry-nacos}/LICENSE (100%) rename {registry/nacos => registry-nacos}/src/lib.rs (100%) rename {registry/nacos => registry-nacos}/src/nacos_registry.rs (99%) rename {registry/nacos => registry-nacos}/src/utils/mod.rs (100%) rename {registry/zookeeper => registry-zookeeper}/Cargo.toml (68%) rename {registry/zookeeper => registry-zookeeper}/LICENSE (100%) rename {registry/zookeeper => registry-zookeeper}/src/lib.rs (100%) rename {registry/zookeeper => registry-zookeeper}/src/zookeeper_registry.rs (99%) create mode 100644 registry/Cargo.toml create mode 100644 registry/LICENSE create mode 100644 registry/src/lib.rs diff --git a/Cargo.toml b/Cargo.toml index ae339cd7..d18fab3b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,9 @@ [workspace] members = [ "xds", - "registry/zookeeper", - "registry/nacos", + "registry", + "registry-zookeeper", + "registry-nacos", "metadata", "config", "dubbo", @@ -26,10 +27,4 @@ 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 93ba6d9a..82d1554c 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 ccb385cd..c095ddf5 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,12 +40,16 @@ pub mod echo_client { &mut self, request: Request, ) -> Result, dubbo::status::Status> { - let codec = - dubbo::codegen::ProstCodec::::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. @@ -53,51 +57,51 @@ pub mod echo_client { &mut self, request: Request, ) -> Result>, dubbo::status::Status> { - let codec = - dubbo::codegen::ProstCodec::::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, ) -> Result, dubbo::status::Status> { - let codec = - dubbo::codegen::ProstCodec::::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, ) -> Result>, dubbo::status::Status> { - let codec = - dubbo::codegen::ProstCodec::::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 } } } @@ -114,7 +118,9 @@ pub mod echo_server { request: Request, ) -> Result, dubbo::status::Status>; ///Server streaming response type for the ServerStreamingEcho method. - type ServerStreamingEchoStream: futures_util::Stream> + type ServerStreamingEchoStream: futures_util::Stream< + Item = Result, + > + Send + 'static; /// ServerStreamingEcho is server side streaming. @@ -128,14 +134,19 @@ pub mod echo_server { request: Request>, ) -> Result, dubbo::status::Status>; ///Server streaming response type for the BidirectionalStreamingEcho method. - type BidirectionalStreamingEchoStream: futures_util::Stream> + type BidirectionalStreamingEchoStream: futures_util::Stream< + Item = Result, + > + Send + 'static; /// BidirectionalStreamingEcho is bidi streaming. async fn bidirectional_streaming_echo( &self, request: Request>, - ) -> Result, dubbo::status::Status>; + ) -> Result< + Response, + dubbo::status::Status, + >; } /// Echo is the echo service. #[derive(Debug)] @@ -165,7 +176,10 @@ pub mod echo_server { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; - fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll> { + fn poll_ready( + &mut self, + _cx: &mut Context<'_>, + ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { @@ -178,18 +192,26 @@ pub mod echo_server { } impl UnarySvc for UnaryEchoServer { type Response = super::EchoResponse; - type Future = BoxFuture, dubbo::status::Status>; - fn call(&mut self, request: Request) -> Self::Future { + type Future = BoxFuture< + Response, + dubbo::status::Status, + >; + fn call( + &mut self, + request: Request, + ) -> 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) }; @@ -200,22 +222,32 @@ pub mod echo_server { struct ServerStreamingEchoServer { inner: _Inner, } - impl ServerStreamingSvc for ServerStreamingEchoServer { + impl ServerStreamingSvc + for ServerStreamingEchoServer { type Response = super::EchoResponse; type ResponseStream = T::ServerStreamingEchoStream; - type Future = - BoxFuture, dubbo::status::Status>; - fn call(&mut self, request: Request) -> Self::Future { + type Future = BoxFuture< + Response, + dubbo::status::Status, + >; + fn call( + &mut self, + request: Request, + ) -> 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; @@ -228,23 +260,31 @@ pub mod echo_server { struct ClientStreamingEchoServer { inner: _Inner, } - impl ClientStreamingSvc for ClientStreamingEchoServer { + impl ClientStreamingSvc + for ClientStreamingEchoServer { type Response = super::EchoResponse; - type Future = BoxFuture, dubbo::status::Status>; + type Future = BoxFuture< + Response, + dubbo::status::Status, + >; fn call( &mut self, request: Request>, ) -> 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; @@ -257,41 +297,56 @@ pub mod echo_server { struct BidirectionalStreamingEchoServer { inner: _Inner, } - impl StreamingSvc for BidirectionalStreamingEchoServer { + impl StreamingSvc + for BidirectionalStreamingEchoServer { type Response = super::EchoResponse; type ResponseStream = T::BidirectionalStreamingEchoStream; - type Future = - BoxFuture, dubbo::status::Status>; + type Future = BoxFuture< + Response, + dubbo::status::Status, + >; fn call( &mut self, request: Request>, ) -> 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 0b14d1a7..491f4054 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/nacos/Cargo.toml b/registry-nacos/Cargo.toml similarity index 73% rename from registry/nacos/Cargo.toml rename to registry-nacos/Cargo.toml index 36a8fd14..2a86a457 100644 --- a/registry/nacos/Cargo.toml +++ b/registry-nacos/Cargo.toml @@ -10,10 +10,11 @@ repository = "https://github.com/apache/dubbo-rust.git" [dependencies] nacos-sdk = { version = "0.2", features = ["naming", "auth-by-http"] } -dubbo.workspace = true -serde_json.workspace = true -serde = { workspace = true, features = ["derive"] } -anyhow.workspace = true -logger.workspace = true +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" + [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 0ec8b400..2d0d6695 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/zookeeper/Cargo.toml b/registry-zookeeper/Cargo.toml similarity index 68% rename from registry/zookeeper/Cargo.toml rename to registry-zookeeper/Cargo.toml index a6687d93..f83283bb 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.workspace = true -serde_json.workspace = true -serde = { workspace = true, features = ["derive"] } -urlencoding.workspace = true -logger.workspace = true +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" 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 9f7447b5..b31d25c1 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) { - info!("{:?}", e) + println!("{:?}", e) } } @@ -240,7 +240,7 @@ impl Default for ZookeeperRegistry { impl Registry for ZookeeperRegistry { fn register(&mut self, url: Url) -> Result<(), StdError> { - debug!("register url: {}", url); + println!("register url: {}", url); let zk_path = format!( "/{}/{}/{}/{}", DUBBO_KEY, diff --git a/registry/Cargo.toml b/registry/Cargo.toml new file mode 100644 index 00000000..3325fa88 --- /dev/null +++ b/registry/Cargo.toml @@ -0,0 +1,11 @@ +[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 new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/registry/LICENSE @@ -0,0 +1,202 @@ + + 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/src/lib.rs b/registry/src/lib.rs new file mode 100644 index 00000000..3e01853c --- /dev/null +++ b/registry/src/lib.rs @@ -0,0 +1,25 @@ +/* + * 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); + } +}