This is an automated email from the ASF dual-hosted git repository. liujun pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/dubbo-rust.git
commit 891b189e56deabb413962367c3eb5e2b22d0a5d2 Author: yangyang <[email protected]> AuthorDate: Thu Jul 21 21:47:51 2022 +0800 style: add license header --- dubbo/src/echo/helloworld.rs | 7 +- dubbo/src/init.rs | 110 --------------------------- dubbo/src/protocol/triple/mod.rs | 17 +++++ dubbo/src/protocol/triple/triple_exporter.rs | 17 +++++ dubbo/src/protocol/triple/triple_invoker.rs | 17 +++++ dubbo/src/protocol/triple/triple_protocol.rs | 17 +++++ dubbo/src/protocol/triple/triple_server.rs | 17 +++++ triple/src/codec/prost.rs | 17 +++++ 8 files changed, 103 insertions(+), 116 deletions(-) diff --git a/dubbo/src/echo/helloworld.rs b/dubbo/src/echo/helloworld.rs index 9497f4b..039ac43 100644 --- a/dubbo/src/echo/helloworld.rs +++ b/dubbo/src/echo/helloworld.rs @@ -15,11 +15,6 @@ * limitations under the License. */ - - - - - /// The request message containing the user's name. #[derive(Clone, PartialEq, ::prost::Message)] pub struct HelloRequest { @@ -38,7 +33,7 @@ pub mod greeter_client { use triple::client::TripleClient; use triple::codec::prost::ProstCodec; use triple::invocation::*; - + /// The greeting service definition. #[derive(Debug, Clone)] pub struct GreeterClient { diff --git a/dubbo/src/init.rs b/dubbo/src/init.rs deleted file mode 100644 index e0d738c..0000000 --- a/dubbo/src/init.rs +++ /dev/null @@ -1,110 +0,0 @@ -// /// Server 启动的入口。业务侧需要调用该函数进行初始化 -// /// -// use std::collections::HashMap; - -// use crate::common::url::Url; -// use config::{BusinessConfig, RootConfig}; - -// pub fn init() { -// let _root_config = RootConfig::new().load(); -// let service_config = ServiceConfig::default() -// .group("helloworld".to_string()) -// .serializer("json".to_string()) -// .version("1.0".to_string()) -// .name("echo".to_string()); - -// let triple_config = ProtocolConfig::default() -// .name("triple".to_string()) -// .ip("0.0.0.0".to_string()) -// .port("8888".to_string()); - -// let _service_config = service_config.add_protocol_configs(triple_config); -// // 根据不同的协议,加载不同的配置 -// // 初始化全局的services -// // let server = DubboServer::init(); -// // let server = server.add_service("echo".to_string(), service); -// } - -// #[derive(Default)] -// pub struct ServiceConfig { -// version: String, -// group: String, -// name: String, -// protocol_names: Vec<String>, -// registry_names: Vec<String>, -// serializer: String, -// protocol_configs: HashMap<String, ProtocolConfig>, -// } - -// impl ServiceConfig { -// pub fn name(self, name: String) -> Self { -// Self { name, ..self } -// } - -// pub fn version(self, version: String) -> Self { -// Self { version, ..self } -// } - -// pub fn group(self, group: String) -> Self { -// Self { group, ..self } -// } - -// pub fn protocol_names(self, protocol_names: Vec<String>) -> Self { -// Self { -// protocol_names, -// ..self -// } -// } - -// pub fn serializer(self, serializer: String) -> Self { -// Self { serializer, ..self } -// } - -// pub fn add_protocol_configs(mut self, protocol_config: ProtocolConfig) -> Self { -// self.protocol_configs -// .insert(protocol_config.name.clone(), protocol_config); -// Self { ..self } -// } - -// pub fn get_url(&self) -> Vec<Url> { -// let mut urls = Vec::new(); -// for (_, conf) in self.protocol_configs.iter() { -// urls.push(Url { -// url: conf.to_owned().to_url(), -// service_key: "".to_string(), -// }); -// } - -// urls -// } -// } - -// #[derive(Default, Debug, Clone)] -// pub struct ProtocolConfig { -// ip: String, -// port: String, -// name: String, -// params: HashMap<String, String>, -// } - -// impl ProtocolConfig { -// pub fn name(self, name: String) -> Self { -// Self { name, ..self } -// } - -// pub fn ip(self, ip: String) -> Self { -// Self { ip, ..self } -// } - -// pub fn port(self, port: String) -> Self { -// Self { port, ..self } -// } - -// pub fn params(self, params: HashMap<String, String>) -> Self { -// Self { params, ..self } -// } - -// pub fn to_url(self) -> String { -// format!("{}://{}:{}", self.name, self.ip, self.port).to_string() -// } -// } diff --git a/dubbo/src/protocol/triple/mod.rs b/dubbo/src/protocol/triple/mod.rs index 32728c3..0e84907 100644 --- a/dubbo/src/protocol/triple/mod.rs +++ b/dubbo/src/protocol/triple/mod.rs @@ -1,3 +1,20 @@ +/* + * 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. + */ + pub mod triple_exporter; pub mod triple_invoker; pub mod triple_protocol; diff --git a/dubbo/src/protocol/triple/triple_exporter.rs b/dubbo/src/protocol/triple/triple_exporter.rs index fcddf79..48ceab3 100644 --- a/dubbo/src/protocol/triple/triple_exporter.rs +++ b/dubbo/src/protocol/triple/triple_exporter.rs @@ -1,3 +1,20 @@ +/* + * 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. + */ + use super::triple_invoker::TripleInvoker; use crate::protocol::Exporter; diff --git a/dubbo/src/protocol/triple/triple_invoker.rs b/dubbo/src/protocol/triple/triple_invoker.rs index 9f064ab..a7d0587 100644 --- a/dubbo/src/protocol/triple/triple_invoker.rs +++ b/dubbo/src/protocol/triple/triple_invoker.rs @@ -1,3 +1,20 @@ +/* + * 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. + */ + use crate::common::url::Url; use crate::protocol::Invoker; diff --git a/dubbo/src/protocol/triple/triple_protocol.rs b/dubbo/src/protocol/triple/triple_protocol.rs index e3abb48..ba517bb 100644 --- a/dubbo/src/protocol/triple/triple_protocol.rs +++ b/dubbo/src/protocol/triple/triple_protocol.rs @@ -1,3 +1,20 @@ +/* + * 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. + */ + use std::collections::HashMap; use async_trait::async_trait; diff --git a/dubbo/src/protocol/triple/triple_server.rs b/dubbo/src/protocol/triple/triple_server.rs index b596bb9..e49694b 100644 --- a/dubbo/src/protocol/triple/triple_server.rs +++ b/dubbo/src/protocol/triple/triple_server.rs @@ -1,3 +1,20 @@ +/* + * 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. + */ + use std::{net::ToSocketAddrs, str::FromStr}; use triple::transport::DubboServer; diff --git a/triple/src/codec/prost.rs b/triple/src/codec/prost.rs index 162ac51..fb52e39 100644 --- a/triple/src/codec/prost.rs +++ b/triple/src/codec/prost.rs @@ -1,3 +1,20 @@ +/* + * 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. + */ + use super::{Codec, DecodeBuf, Decoder, EncodeBuf, Encoder}; use prost::Message; use std::marker::PhantomData;
