Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rft: using subpackage to manage registry implementations for avoiding root-level directory abuse. #121

Merged
merged 4 commits into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
[workspace]
members = [
"xds",
"registry",
"registry-zookeeper",
"registry-nacos",
"registry/zookeeper",
"registry/nacos",
"metadata",
"config",
"dubbo",
Expand All @@ -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/" }

2 changes: 1 addition & 1 deletion examples/echo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
187 changes: 66 additions & 121 deletions examples/echo/src/generated/grpc.examples.echo.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/greeter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
11 changes: 0 additions & 11 deletions registry/Cargo.toml

This file was deleted.

202 changes: 0 additions & 202 deletions registry/LICENSE

This file was deleted.

11 changes: 5 additions & 6 deletions registry-nacos/Cargo.toml → registry/nacos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
File renamed without changes.
25 changes: 0 additions & 25 deletions registry/src/lib.rs

This file was deleted.

10 changes: 5 additions & 5 deletions registry-zookeeper/Cargo.toml → registry/zookeeper/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand All @@ -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)
}
}

Expand Down Expand Up @@ -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,
Expand Down