Skip to content

Commit

Permalink
feat: create crates
Browse files Browse the repository at this point in the history
  • Loading branch information
houseme committed Dec 20, 2023
1 parent c767b38 commit 7870222
Show file tree
Hide file tree
Showing 13 changed files with 268 additions and 9 deletions.
43 changes: 35 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,40 +25,67 @@ categories = ["config", "asynchronous", "development-tools"]
[workspace.dependencies]
base64 = "0.21"
bytes = "1"
bcrypt = "0.14"
bcrypt = "0.15.0"
encoding_rs = "0.8"
form_urlencoded = "1"
headers = "0.3"
http = "0.2"
hyper = "0.14"
hyper = "1.0.1"
hyper-timeout = "0.4"
hmac = "0.12"
hex = "0.4"
log = "0.4"

openssl = "0.10"
opentelemetry-http = { version = "0.10", default-features = false }
opentelemetry-semantic-conventions = { version = "0.13", default-features = false }
opentelemetry-prometheus = { version = "0.14", default-features = false }
opentelemetry = { version = "0.21", default-features = false }

polaris-circuitbreak = { path = "./crates/circuitbreak", version = "0.1.3" }
polaris-config = { path = "./crates/config", version = "0.1.3" }
polaris-core = { path = "./crates/core", version = "0.1.3" }
polaris-discovery = { path = "./crates/discovery", version = "0.1.3" }
polaris-loadbalance = { path = "./crates/loadbalance", version = "0.1.3" }
polaris-middleware = { path = "./crates/middleware", version = "0.1.3" }
polaris-observability = { path = "./crates/observability", version = "0.1.3" }
polaris-ratelimit = { path = "./crates/ratelimit", version = "0.1.3" }
polaris-registry = { path = "./crates/registry", version = "0.1.3" }
polaris-router = { path = "./crates/router", version = "0.1.3" }
polaris-specification = "0.1.1"

polaris-specification = "1.4.1"

quinn = { version = "0.10", default-features = false }
quote = "1"
rand = "0.8"
rcgen = "0.10"
rcgen = "0.11"
regex = "1"
rustls = "0.20"
reqwest = { version = "0.11", default-features = false }
ring = "0.17"
rust_decimal = "1"
rustls = "0.21"
rustls-pemfile = "1"

serde = "1"
serde_json = "1"
serde-xml-rs = "0.6"
serde_urlencoded = "0.7"
serde_yaml = "0.9"
sha2 = "0.10"
tokio = "1"
tokio-native-tls = "0.3"
tokio-rustls = "0.23"
tokio-rustls = "0.24.0"
tokio-openssl = "0.6"
tokio-stream = { version = "0.1", default-features = false }
tokio-util = "0.7"
tokio-tungstenite = { version = "0.18", default-features = false }
tokio-tungstenite = { version = "0.20.1", default-features = false }
tracing = "0.1"
tracing-subscriber = "0.3"
tracing-test = "0.2.1"
url = "2"
x509-parser = "0.15.0"
x509-parser = "0.15.0"

# Compress
brotli = { version = "3.3", default-features = false }
flate2 = { version = "1.0", default-features = false }
zstd = { version = "0.13", default-features = false }
2 changes: 1 addition & 1 deletion LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 houseme
Copyright (c) 2022 Polaris Mesh

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
18 changes: 18 additions & 0 deletions crates/circuitbreak/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "polaris-circuitbreak"
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
description.workspace = true
homepage.workspace = true
repository.workspace = true
documentation.workspace = true
readme.workspace = true
keywords.workspace = true
categories.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
14 changes: 14 additions & 0 deletions crates/circuitbreak/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
pub fn add(left: usize, right: usize) -> usize {
left + right
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
18 changes: 18 additions & 0 deletions crates/discovery/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "polaris-discovery"
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
description.workspace = true
homepage.workspace = true
repository.workspace = true
documentation.workspace = true
readme.workspace = true
keywords.workspace = true
categories.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
14 changes: 14 additions & 0 deletions crates/discovery/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
pub fn add(left: usize, right: usize) -> usize {
left + right
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
18 changes: 18 additions & 0 deletions crates/loadbalance/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "polaris-loadbalance"
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
description.workspace = true
homepage.workspace = true
repository.workspace = true
documentation.workspace = true
readme.workspace = true
keywords.workspace = true
categories.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
14 changes: 14 additions & 0 deletions crates/loadbalance/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
pub fn add(left: usize, right: usize) -> usize {
left + right
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
18 changes: 18 additions & 0 deletions crates/middleware/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "polaris-middleware"
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
description.workspace = true
homepage.workspace = true
repository.workspace = true
documentation.workspace = true
readme.workspace = true
keywords.workspace = true
categories.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
14 changes: 14 additions & 0 deletions crates/middleware/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
pub fn add(left: usize, right: usize) -> usize {
left + right
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
18 changes: 18 additions & 0 deletions crates/observability/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "polaris-observability"
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
description.workspace = true
homepage.workspace = true
repository.workspace = true
documentation.workspace = true
readme.workspace = true
keywords.workspace = true
categories.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
14 changes: 14 additions & 0 deletions crates/observability/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
pub fn add(left: usize, right: usize) -> usize {
left + right
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
72 changes: 72 additions & 0 deletions docs/Introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@

# Introduction

## 目录结构:
```html
polaris-rust
├── core
├── discovery
├── loadbalance
├── circuitbreak
├── ratelimit
├── config
├── observability
├── middleware
├── polaris
│ └── src
├── examples
├── benches
├── scripts
├── Cargo.toml
└── README.md
```
```html
core: 公共依赖、抽象和工具
discovery: 服务发现和注册相关
circuitbreak: 熔断功能
ratelimit: 限流功能
config: 配置管理
observability: metrics 和 tracing
middleware: 各种中间件
examples: 示例程序
benches: 基准测试
scripts: 构建、发布等脚本
```

```html
core
// 公共依赖、抽象和工具

discovery
// 服务发现和注册

loadbalance
// 负载均衡

circuitbreak
// 熔断

ratelimit
// 限流

config
// 配置管理

observability
// 指标上报和追踪

middleware
// 中间件,如日志、监控等

polaris
// SDK 统一出口

examples
// 示例程序

benches
// 基准测试

scripts
// 构建和发布脚本
```

0 comments on commit 7870222

Please sign in to comment.