Skip to content

Commit

Permalink
Feat: cluster and extension (#185)
Browse files Browse the repository at this point in the history
* feat(dubbo): add unix feature

* Rft: replace feature with target_os cfg

* Rft(dubbo): add ClientBuilder for client

* Rftï(dubbo-build): add build api for client

* style(examples): cargo fmt

* Rft: move connection from client to transport mod

* Rft(dubbo): add default timeout for client

* Ftr: add serverBuilder for Server, support multiple ways to start server

* Rft(examples): update yaml

* refactor(dubbo): update invoker trait

* refactor(cluster): add Cluster MockImpl

* refactor(triple): use ClientBuilder to init Cluster ability

* Update builder.rs

update default direct value

* Update triple.rs

handle unused var

* Update mod.rs

comment some codes

* refactor(triple): rm unused var in clientBuilder

* refactor(dubbo): delete some codes

* refactor(cluster): rm some duplicate codes

* refactor(registry): rm unused import

* refactor(triple): use two build func for different usage

* style: cargo fmt --all

* refactor(cluster): rm registryWrapper

* refactor(cluster): delete print

* chore(dubbo): upgrade hyper version in cargo.toml

* refactor(cluster): comment the logic of clone body

* Rft(triple): remove Clone of Invoker

* Rft(cluster): use ready_cache to manage Invokers, add ready_cache in FailoverCluster

* Rft(protocol): use interface Inheritance to redesign Invoker

* Feat(cluster): Cluster Policy Impl (#146)

* refactor(cluster): comment the logic of clone body

* Rft(triple): remove Clone of Invoker

* Rft(cluster): use ready_cache to manage Invokers, add ready_cache in FailoverCluster

* Rft(protocol): use interface Inheritance to redesign Invoker

---------

Co-authored-by: G-XD <[email protected]>
Co-authored-by: GXD <[email protected]>

* chore(github): rm workflow_dispatch in workflow (#149)

* feat: Add Router Module(#144) (#153)

add condition router,
add tag router,
use nacos as router config center

* Ftr: failover cluster (#156)

* Ftr: add ServiceNameDirectory (#157)

* Ftr: failover cluster

* Ftr: add ServiceNameDirectory

* Feat/cluster Optimized the Router module (#160)

* perf: Optimized the logic of the routing module.

Refactored route logic decision-making, eliminating unnecessary cloning
and improving performance.

* perf: Optimized the logic of the routing module.

Refactored route logic decision-making, eliminating unnecessary cloning
and improving performance.

* perf: Removed unnecessary configurations.

* perf: Removed unnecessary configurations.

* perf: Optimized the Router module

Optimized the Router module
Added Router Chain to MockDirectory

* Refactor: refactor Cluster component (#165)

* Refactor: refactor Cluster component

- add p2c loadbalance component
- add simple router component
- add replay body component
- add failover component
- add service directory compoent

* Enhance: add cache for routers

* Tst: local test passed (#166)

* Tst: local test passed

* Enhance: remove unnecessary key

* Enhance: add BUFFER SIZE const variable

* style(dubbo): cargo fmt --all

* style(dubbo): cargo fix --lib -p dubbo --allow-dirty

* chore(github): update branch in pr

* Mod: format code and fix some warnings (#167)

* style(dubbo): cargo fmt --all

* style(dubbo): cargo fix --lib -p dubbo --allow-dirty

* chore(github): update branch in pr

* Rft: adapt nacos registry and zookeeper registry (#169)

* Rft: adapt nacos registry and zookeeper registry

Close #168

* Rft: adapt static registry

* Rft: cargo fmt

* Ftr: add extension module (#181)

* Ftr: add extension module

- adapt static registry by extension
- adapt nacos  registry by extension

link #180

* cargo fmt all

* fix ci error

* fix nacos image version error

* Rft: re-design extension register

* Fix: cargo fix

* Fix: add some license for every files

- extract UrlParam to single file
- fix github ci error

* Fix: fmt all

* Fix: Add license for extension_param.rs and registry_param.rs

* Fix: rename query_param_by_kv method name

* Fix: get stuck when load extension in the concurrency environment (#184)

* Fix: get stuck when load extension in the concurrency environment

- Add a new struct called LoadExtensionPromise
- Remove async modifier in ExtensionDirectory

Close #183

* Ftr: use RwLock instead of unsafe

* Rft: simplify the code of extension promise resolve

* refeat(extensions): add sync for Registry trait

* chore: cargo fmt

* chore: cargo fmt

* chore: cargo fmt

* chore: cargo fmt

---------

Co-authored-by: G-XD <[email protected]>
Co-authored-by: GXD <[email protected]>
Co-authored-by: Urara <[email protected]>
Co-authored-by: 毛文超 <[email protected]>
  • Loading branch information
5 people authored Mar 29, 2024
1 parent 15b2ac2 commit 13bb389
Show file tree
Hide file tree
Showing 72 changed files with 5,201 additions and 1,934 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ on:
push:
branches: ["*"]
pull_request:
branches: ["*"]
branches:
- '*'
- 'refact/*'

workflow_dispatch:

jobs:
check:
Expand Down Expand Up @@ -59,6 +60,13 @@ jobs:
- 2181:2181
env:
ZOO_MY_ID: 1
nacos:
image: nacos/nacos-server:v2.3.1
ports:
- 8848:8848
- 9848:9848
env:
MODE: standalone
steps:
- uses: actions/checkout@main
- uses: actions-rs/toolchain@v1
Expand Down
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
resolver = "2"
members = [
"common/logger",
"common/utils",
Expand Down Expand Up @@ -59,5 +60,7 @@ itertools = "0.10.1"
bytes = "1.0"
prost-serde = "0.3.0"
prost-serde-derive = "0.1.2"
url = "2.5.0"



7 changes: 6 additions & 1 deletion application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@ dubbo:
references:
GreeterClientImpl:
url: tri://localhost:20000
protocol: tri
protocol: tri
routers:
consumer:
- service: "org.apache.dubbo.sample.tri.Greeter"
url: tri://127.0.0.1:20000
protocol: triple
5 changes: 2 additions & 3 deletions common/base/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
urlencoding.workspace = true
http = "0.2"
dubbo-logger.workspace = true
dubbo-logger.workspace = true
url.workspace = true
85 changes: 85 additions & 0 deletions common/base/src/extension_param.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
* 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::{url::UrlParam, StdError};
use std::{borrow::Cow, convert::Infallible, str::FromStr};

pub struct ExtensionName(String);

impl ExtensionName {
pub fn new(name: String) -> Self {
ExtensionName(name)
}
}

impl UrlParam for ExtensionName {
type TargetType = String;

fn name() -> &'static str {
"extension-name"
}

fn value(&self) -> Self::TargetType {
self.0.clone()
}

fn as_str(&self) -> Cow<str> {
self.0.as_str().into()
}
}

impl FromStr for ExtensionName {
type Err = StdError;

fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(ExtensionName::new(s.to_string()))
}
}

pub enum ExtensionType {
Registry,
}

impl UrlParam for ExtensionType {
type TargetType = String;

fn name() -> &'static str {
"extension-type"
}

fn value(&self) -> Self::TargetType {
match self {
ExtensionType::Registry => "registry".to_owned(),
}
}

fn as_str(&self) -> Cow<str> {
match self {
ExtensionType::Registry => Cow::Borrowed("registry"),
}
}
}

impl FromStr for ExtensionType {
type Err = Infallible;

fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"registry" => Ok(ExtensionType::Registry),
_ => panic!("the extension type enum is not in range"),
}
}
}
4 changes: 4 additions & 0 deletions common/base/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@
allow(dead_code, unused_imports, unused_variables, unused_mut)
)]
pub mod constants;
pub mod extension_param;
pub mod node;
pub mod registry_param;
pub mod url;

pub use node::Node;
pub use url::Url;

pub type StdError = Box<dyn std::error::Error + Send + Sync + 'static>;
Loading

0 comments on commit 13bb389

Please sign in to comment.