From e466c477e419080ac4c61ff3be9b165373f8494a Mon Sep 17 00:00:00 2001
From: Forsworns <378974295@qq.com>
Date: Mon, 28 Feb 2022 11:31:46 +0800
Subject: [PATCH] =?UTF-8?q?refactor:=20=E2=9C=82=20=20Rename=20packages?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
for releasing
---
.github/workflows/grcov.yml | 2 +-
.github/workflows/platforms.yml | 23 ++++++++++
.github/workflows/style.yml | 4 +-
.gitignore | 1 -
CONTRIBUTING.md | 4 +-
Cargo.lock | 42 +++++++++----------
Cargo.toml | 9 +++-
README.md | 10 ++---
examples/config/from_entity/from_entity.rs | 10 ++---
examples/config/from_yaml/from_yaml.rs | 8 ++--
examples/datasources/consul.rs | 8 ++--
examples/datasources/etcdv3.rs | 8 ++--
examples/datasources/k8s.rs | 8 ++--
examples/ebpf/userspace/Cargo.toml | 2 +-
examples/ebpf/userspace/src/port.rs | 8 ++--
examples/exporter/prometheus/prometheus.rs | 14 +++----
examples/proxy/envoy/Cargo.toml | 4 +-
examples/proxy/envoy/src/lib.rs | 8 ++--
examples/rules/circuit_breaker/error_count.rs | 12 +++---
examples/rules/circuit_breaker/error_ratio.rs | 12 +++---
.../rules/circuit_breaker/slow_request.rs | 12 +++---
examples/rules/flow/hello_world.rs | 8 ++--
examples/rules/flow/macro.rs | 6 +--
examples/rules/flow/memory_adaptive.rs | 6 +--
examples/rules/flow/method.rs | 4 +-
examples/rules/flow/throttling.rs | 6 +--
examples/rules/flow/tokio.rs | 6 +--
examples/rules/hotspot/concurrency.rs | 10 ++---
examples/rules/hotspot/qps_reject.rs | 10 ++---
examples/rules/hotspot/qps_throttling.rs | 10 ++---
examples/rules/isolation/concurrency.rs | 10 ++---
examples/rules/system/avg_rt.rs | 6 +--
examples/rules/system/concurrency.rs | 10 ++---
examples/rules/system/cpu_usage.rs | 8 ++--
examples/rules/system/inbound_qps.rs | 6 +--
examples/rules/system/load.rs | 6 +--
grc.toml | 2 +-
{sentinel => sentinel-core}/Cargo.toml | 4 +-
{sentinel => sentinel-core}/LICENSE | 0
{sentinel => sentinel-core}/README.md | 10 ++---
{sentinel => sentinel-core}/src/api/api.rs | 0
{sentinel => sentinel-core}/src/api/init.rs | 0
{sentinel => sentinel-core}/src/api/mod.rs | 2 +-
.../src/api/slot_chain.rs | 0
.../src/core/base/block_error.rs | 0
.../src/core/base/constant.rs | 0
.../src/core/base/context.rs | 0
.../src/core/base/entry.rs | 0
.../src/core/base/metric_item.rs | 0
.../src/core/base/mod.rs | 0
.../src/core/base/resource.rs | 0
.../src/core/base/result.rs | 0
.../src/core/base/rule.rs | 0
.../src/core/base/slot_chain.rs | 0
.../src/core/base/stat.rs | 0
.../circuitbreaker/breaker/error_count.rs | 0
.../circuitbreaker/breaker/error_ratio.rs | 0
.../src/core/circuitbreaker/breaker/mod.rs | 0
.../circuitbreaker/breaker/slow_request.rs | 0
.../src/core/circuitbreaker/breaker/stat.rs | 0
.../src/core/circuitbreaker/mod.rs | 0
.../src/core/circuitbreaker/rule.rs | 0
.../src/core/circuitbreaker/rule_manager.rs | 0
.../src/core/circuitbreaker/slot.rs | 0
.../src/core/circuitbreaker/stat_slot.rs | 0
.../src/core/config/config.rs | 0
.../src/core/config/constant.rs | 0
.../src/core/config/entity.rs | 0
.../src/core/config/mod.rs | 0
.../src/core/flow/mod.rs | 0
.../src/core/flow/rule.rs | 0
.../src/core/flow/rule_manager.rs | 0
.../src/core/flow/slot.rs | 0
.../src/core/flow/standalone_stat_slot.rs | 0
.../src/core/flow/traffic_shaping/adaptive.rs | 0
.../src/core/flow/traffic_shaping/default.rs | 0
.../src/core/flow/traffic_shaping/mod.rs | 0
.../core/flow/traffic_shaping/throttling.rs | 0
.../src/core/flow/traffic_shaping/warmup.rs | 0
.../src/core/hotspot/cache.rs | 0
.../src/core/hotspot/concurrency_stat_slot.rs | 0
.../src/core/hotspot/mod.rs | 0
.../src/core/hotspot/param_metric.rs | 0
.../src/core/hotspot/rule.rs | 0
.../src/core/hotspot/rule_manager.rs | 0
.../src/core/hotspot/slot.rs | 0
.../src/core/hotspot/traffic_shaping/mod.rs | 0
.../core/hotspot/traffic_shaping/reject.rs | 0
.../hotspot/traffic_shaping/throttling.rs | 0
.../src/core/isolation/mod.rs | 0
.../src/core/isolation/rule.rs | 0
.../src/core/isolation/rule_manager.rs | 0
.../src/core/isolation/slot.rs | 0
.../src/core/log/metric/aggregator.rs | 0
.../src/core/log/metric/mod.rs | 0
.../src/core/log/metric/reader.rs | 0
.../src/core/log/metric/searcher.rs | 0
.../src/core/log/metric/writer.rs | 0
.../src/core/log/mod.rs | 0
.../src/core/log/slot.rs | 0
{sentinel => sentinel-core}/src/core/mod.rs | 0
.../src/core/stat/base/bucket_leap_array.rs | 0
.../src/core/stat/base/leap_array.rs | 0
.../src/core/stat/base/metric_bucket.rs | 0
.../src/core/stat/base/mod.rs | 0
.../core/stat/base/sliding_window_metric.rs | 0
.../src/core/stat/mod.rs | 0
.../src/core/stat/node_storage.rs | 0
.../src/core/stat/resource_node.rs | 0
.../src/core/stat/stat_prepare_slot.rs | 0
.../src/core/stat/stat_slot.rs | 0
.../src/core/system/mod.rs | 0
.../src/core/system/rule.rs | 0
.../src/core/system/rule_manager.rs | 0
.../src/core/system/slot.rs | 0
.../src/core/system_metric.rs | 0
.../src/datasource/datasource/ds_consul.rs | 0
.../src/datasource/datasource/ds_etcdv3.rs | 0
.../src/datasource/datasource/ds_k8s.rs | 0
.../src/datasource/datasource/mod.rs | 0
.../src/datasource/helpers.rs | 0
.../src/datasource/mod.rs | 0
.../src/datasource/property.rs | 0
{sentinel => sentinel-core}/src/exporter.rs | 0
{sentinel => sentinel-core}/src/lib.rs | 0
{sentinel => sentinel-core}/src/logging.rs | 0
{sentinel => sentinel-core}/src/macros/cfg.rs | 0
.../src/macros/flow.rs | 0
{sentinel => sentinel-core}/src/macros/mod.rs | 0
.../src/proxy/envoy.rs | 0
{sentinel => sentinel-core}/src/utils/mod.rs | 0
{sentinel => sentinel-core}/src/utils/time.rs | 0
{sentinel => sentinel-core}/tests/mod.rs | 0
sentinel-macros/Cargo.toml | 2 +-
sentinel-macros/src/flow.rs | 2 -
sentinel-macros/src/lib.rs | 2 +-
sentinel-macros/src/utils.rs | 6 +--
137 files changed, 189 insertions(+), 162 deletions(-)
rename {sentinel => sentinel-core}/Cargo.toml (98%)
rename {sentinel => sentinel-core}/LICENSE (100%)
rename {sentinel => sentinel-core}/README.md (89%)
rename {sentinel => sentinel-core}/src/api/api.rs (100%)
rename {sentinel => sentinel-core}/src/api/init.rs (100%)
rename {sentinel => sentinel-core}/src/api/mod.rs (97%)
rename {sentinel => sentinel-core}/src/api/slot_chain.rs (100%)
rename {sentinel => sentinel-core}/src/core/base/block_error.rs (100%)
rename {sentinel => sentinel-core}/src/core/base/constant.rs (100%)
rename {sentinel => sentinel-core}/src/core/base/context.rs (100%)
rename {sentinel => sentinel-core}/src/core/base/entry.rs (100%)
rename {sentinel => sentinel-core}/src/core/base/metric_item.rs (100%)
rename {sentinel => sentinel-core}/src/core/base/mod.rs (100%)
rename {sentinel => sentinel-core}/src/core/base/resource.rs (100%)
rename {sentinel => sentinel-core}/src/core/base/result.rs (100%)
rename {sentinel => sentinel-core}/src/core/base/rule.rs (100%)
rename {sentinel => sentinel-core}/src/core/base/slot_chain.rs (100%)
rename {sentinel => sentinel-core}/src/core/base/stat.rs (100%)
rename {sentinel => sentinel-core}/src/core/circuitbreaker/breaker/error_count.rs (100%)
rename {sentinel => sentinel-core}/src/core/circuitbreaker/breaker/error_ratio.rs (100%)
rename {sentinel => sentinel-core}/src/core/circuitbreaker/breaker/mod.rs (100%)
rename {sentinel => sentinel-core}/src/core/circuitbreaker/breaker/slow_request.rs (100%)
rename {sentinel => sentinel-core}/src/core/circuitbreaker/breaker/stat.rs (100%)
rename {sentinel => sentinel-core}/src/core/circuitbreaker/mod.rs (100%)
rename {sentinel => sentinel-core}/src/core/circuitbreaker/rule.rs (100%)
rename {sentinel => sentinel-core}/src/core/circuitbreaker/rule_manager.rs (100%)
rename {sentinel => sentinel-core}/src/core/circuitbreaker/slot.rs (100%)
rename {sentinel => sentinel-core}/src/core/circuitbreaker/stat_slot.rs (100%)
rename {sentinel => sentinel-core}/src/core/config/config.rs (100%)
rename {sentinel => sentinel-core}/src/core/config/constant.rs (100%)
rename {sentinel => sentinel-core}/src/core/config/entity.rs (100%)
rename {sentinel => sentinel-core}/src/core/config/mod.rs (100%)
rename {sentinel => sentinel-core}/src/core/flow/mod.rs (100%)
rename {sentinel => sentinel-core}/src/core/flow/rule.rs (100%)
rename {sentinel => sentinel-core}/src/core/flow/rule_manager.rs (100%)
rename {sentinel => sentinel-core}/src/core/flow/slot.rs (100%)
rename {sentinel => sentinel-core}/src/core/flow/standalone_stat_slot.rs (100%)
rename {sentinel => sentinel-core}/src/core/flow/traffic_shaping/adaptive.rs (100%)
rename {sentinel => sentinel-core}/src/core/flow/traffic_shaping/default.rs (100%)
rename {sentinel => sentinel-core}/src/core/flow/traffic_shaping/mod.rs (100%)
rename {sentinel => sentinel-core}/src/core/flow/traffic_shaping/throttling.rs (100%)
rename {sentinel => sentinel-core}/src/core/flow/traffic_shaping/warmup.rs (100%)
rename {sentinel => sentinel-core}/src/core/hotspot/cache.rs (100%)
rename {sentinel => sentinel-core}/src/core/hotspot/concurrency_stat_slot.rs (100%)
rename {sentinel => sentinel-core}/src/core/hotspot/mod.rs (100%)
rename {sentinel => sentinel-core}/src/core/hotspot/param_metric.rs (100%)
rename {sentinel => sentinel-core}/src/core/hotspot/rule.rs (100%)
rename {sentinel => sentinel-core}/src/core/hotspot/rule_manager.rs (100%)
rename {sentinel => sentinel-core}/src/core/hotspot/slot.rs (100%)
rename {sentinel => sentinel-core}/src/core/hotspot/traffic_shaping/mod.rs (100%)
rename {sentinel => sentinel-core}/src/core/hotspot/traffic_shaping/reject.rs (100%)
rename {sentinel => sentinel-core}/src/core/hotspot/traffic_shaping/throttling.rs (100%)
rename {sentinel => sentinel-core}/src/core/isolation/mod.rs (100%)
rename {sentinel => sentinel-core}/src/core/isolation/rule.rs (100%)
rename {sentinel => sentinel-core}/src/core/isolation/rule_manager.rs (100%)
rename {sentinel => sentinel-core}/src/core/isolation/slot.rs (100%)
rename {sentinel => sentinel-core}/src/core/log/metric/aggregator.rs (100%)
rename {sentinel => sentinel-core}/src/core/log/metric/mod.rs (100%)
rename {sentinel => sentinel-core}/src/core/log/metric/reader.rs (100%)
rename {sentinel => sentinel-core}/src/core/log/metric/searcher.rs (100%)
rename {sentinel => sentinel-core}/src/core/log/metric/writer.rs (100%)
rename {sentinel => sentinel-core}/src/core/log/mod.rs (100%)
rename {sentinel => sentinel-core}/src/core/log/slot.rs (100%)
rename {sentinel => sentinel-core}/src/core/mod.rs (100%)
rename {sentinel => sentinel-core}/src/core/stat/base/bucket_leap_array.rs (100%)
rename {sentinel => sentinel-core}/src/core/stat/base/leap_array.rs (100%)
rename {sentinel => sentinel-core}/src/core/stat/base/metric_bucket.rs (100%)
rename {sentinel => sentinel-core}/src/core/stat/base/mod.rs (100%)
rename {sentinel => sentinel-core}/src/core/stat/base/sliding_window_metric.rs (100%)
rename {sentinel => sentinel-core}/src/core/stat/mod.rs (100%)
rename {sentinel => sentinel-core}/src/core/stat/node_storage.rs (100%)
rename {sentinel => sentinel-core}/src/core/stat/resource_node.rs (100%)
rename {sentinel => sentinel-core}/src/core/stat/stat_prepare_slot.rs (100%)
rename {sentinel => sentinel-core}/src/core/stat/stat_slot.rs (100%)
rename {sentinel => sentinel-core}/src/core/system/mod.rs (100%)
rename {sentinel => sentinel-core}/src/core/system/rule.rs (100%)
rename {sentinel => sentinel-core}/src/core/system/rule_manager.rs (100%)
rename {sentinel => sentinel-core}/src/core/system/slot.rs (100%)
rename {sentinel => sentinel-core}/src/core/system_metric.rs (100%)
rename {sentinel => sentinel-core}/src/datasource/datasource/ds_consul.rs (100%)
rename {sentinel => sentinel-core}/src/datasource/datasource/ds_etcdv3.rs (100%)
rename {sentinel => sentinel-core}/src/datasource/datasource/ds_k8s.rs (100%)
rename {sentinel => sentinel-core}/src/datasource/datasource/mod.rs (100%)
rename {sentinel => sentinel-core}/src/datasource/helpers.rs (100%)
rename {sentinel => sentinel-core}/src/datasource/mod.rs (100%)
rename {sentinel => sentinel-core}/src/datasource/property.rs (100%)
rename {sentinel => sentinel-core}/src/exporter.rs (100%)
rename {sentinel => sentinel-core}/src/lib.rs (100%)
rename {sentinel => sentinel-core}/src/logging.rs (100%)
rename {sentinel => sentinel-core}/src/macros/cfg.rs (100%)
rename {sentinel => sentinel-core}/src/macros/flow.rs (100%)
rename {sentinel => sentinel-core}/src/macros/mod.rs (100%)
rename {sentinel => sentinel-core}/src/proxy/envoy.rs (100%)
rename {sentinel => sentinel-core}/src/utils/mod.rs (100%)
rename {sentinel => sentinel-core}/src/utils/time.rs (100%)
rename {sentinel => sentinel-core}/tests/mod.rs (100%)
diff --git a/.github/workflows/grcov.yml b/.github/workflows/grcov.yml
index c9a8101..4766f7f 100644
--- a/.github/workflows/grcov.yml
+++ b/.github/workflows/grcov.yml
@@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
env:
RUSTFLAGS: -Zinstrument-coverage
- LLVM_PROFILE_FILE: "sentinel-rs-%p-%m.profraw"
+ LLVM_PROFILE_FILE: "sentinel-core-%p-%m.profraw"
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- uses: actions/checkout@v2
diff --git a/.github/workflows/platforms.yml b/.github/workflows/platforms.yml
index e221b65..3335454 100644
--- a/.github/workflows/platforms.yml
+++ b/.github/workflows/platforms.yml
@@ -59,3 +59,26 @@ jobs:
with:
command: test
args: --target=${{ matrix.RUSTC_TARGET }} --workspace --exclude sentinel-envoy-module --exclude ebpf-probes --exclude ebpf-userspace -- --ignored --test-threads=1 --nocapture
+ wasm:
+ name: WebAssembly
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions-rs/toolchain@v1
+ with:
+ toolchain: stable
+ target: wasm32-unknown-unknown
+ - uses: actions/cache@v2
+ with:
+ path: |
+ ~/.cargo/bin/
+ ~/.cargo/registry/index/
+ ~/.cargo/registry/cache/
+ ~/.cargo/git/db/
+ target/
+ key: ${{ runner.os }}-wasm-${{ hashFiles('**/Cargo.lock') }}
+ - name: Build
+ uses: actions-rs/cargo@v1
+ with:
+ command: build
+ args: --target=wasm32-unknown-unknown
\ No newline at end of file
diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml
index e988310..cfddf2d 100644
--- a/.github/workflows/style.yml
+++ b/.github/workflows/style.yml
@@ -58,9 +58,9 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Verify that both READMEs are identical
- run: diff README.md sentinel/README.md
+ run: diff README.md sentinel-core/README.md
- name: Verify that Sentinel version is up to date in README
- working-directory: sentinel
+ working-directory: sentinel-core
run: grep -q "$(sed '/^version = /!d' Cargo.toml | head -n1)" README.md
clippy:
diff --git a/.gitignore b/.gitignore
index c7cdac7..7a239b2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,3 @@
target
data
-log
logs
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 0cc30e9..dc99a7f 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -46,10 +46,10 @@ The final commit message should be clear and concise.
### Open an issue / PR
-We use [GitHub Issues](https://github.com/alibaba/Sentinel/issues) and [Pull Requests](https://github.com/alibaba/Sentinel/pulls) for trackers.
+We use [GitHub Issues](https://github.com/sentinel-group/sentinel-rust/issues) and [Pull Requests](https://github.com/sentinel-group/sentinel-rust/pulls) for trackers.
If you find a typo in document, find a bug in code, or want new features, or want to give suggestions,
-you can [open an issue on GitHub](https://github.com/alibaba/Sentinel/issues/new) to report it.
+you can [open an issue on GitHub](https://github.com/sentinel-group/sentinel-rust/issues/new) to report it.
Please follow the guideline message in the issue template.
If you want to contribute, please follow the [contribution workflow](#github-workflow) and create a new pull request.
diff --git a/Cargo.lock b/Cargo.lock
index c9f5e66..0db5370 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -491,7 +491,7 @@ dependencies = [
"ebpf-probes",
"futures",
"redbpf",
- "sentinel-rs",
+ "sentinel-core",
"tokio",
"tracing",
"tracing-subscriber 0.3.7",
@@ -2086,26 +2086,7 @@ dependencies = [
]
[[package]]
-name = "sentinel-envoy-module"
-version = "0.1.0"
-dependencies = [
- "log",
- "proxy-wasm",
- "sentinel-rs",
-]
-
-[[package]]
-name = "sentinel-macros"
-version = "0.1.0"
-dependencies = [
- "darling",
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "sentinel-rs"
+name = "sentinel-core"
version = "0.1.0"
dependencies = [
"anyhow",
@@ -2140,6 +2121,25 @@ dependencies = [
"uuid",
]
+[[package]]
+name = "sentinel-envoy-module"
+version = "0.1.0"
+dependencies = [
+ "log",
+ "proxy-wasm",
+ "sentinel-core",
+]
+
+[[package]]
+name = "sentinel-macros"
+version = "0.1.0"
+dependencies = [
+ "darling",
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
[[package]]
name = "serde"
version = "1.0.131"
diff --git a/Cargo.toml b/Cargo.toml
index 169c4b8..50aca44 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,3 +1,8 @@
[workspace]
-
-members = ["sentinel", "sentinel-macros", "examples/proxy/envoy", "examples/ebpf/probes", "examples/ebpf/userspace"]
+members = [
+ "sentinel-core",
+ "sentinel-macros",
+ "examples/proxy/envoy",
+ "examples/ebpf/probes",
+ "examples/ebpf/userspace",
+]
diff --git a/README.md b/README.md
index 84d1b8d..17eea93 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-# Sentinel: The Sentinel of Your Microservices (WIP)
+# Sentinel: The Sentinel of Your Microservices
[![Crates.io][crates-badge]][crates-url]
[![Sentinel CI][ci-badge]][ci-url]
@@ -9,8 +9,8 @@
[![Gitter chat][gitter-badge]][gitter-url]
-[crates-badge]: https://img.shields.io/crates/v/sentinel-rs.svg
-[crates-url]: https://crates.io/crates/sentinel-rs
+[crates-badge]: https://img.shields.io/crates/v/sentinel.svg
+[crates-url]: https://crates.io/crates/sentinel-core
[ci-badge]: https://github.com/sentinel-group/sentinel-rust/actions/workflows/ci.yml/badge.svg
[ci-url]: https://github.com/sentinel-group/sentinel-rust/actions/workflows/ci.yml
[codecov-badge]: https://codecov.io/gh/sentinel-group/sentinel-rust/branch/main/graph/badge.svg
@@ -41,7 +41,7 @@ See the [Sentinel](https://sentinelguard.io/en-us/) for the document website.
See the [中文文档](https://sentinelguard.io/zh-cn/) for document in Chinese.
-The [Rust API documentation](https://docs.rs/sentinel-rs/latest) is working in progress.
+The [Rust API documentation](https://docs.rs/sentinel-core/latest) is working in progress.
## Example
@@ -49,7 +49,7 @@ Add the dependency in Cargo.toml:
```toml
[dependencies]
-sentinel-rs = { version = "0.1.0", features = ["full"] }
+sentinel-core = { version = "0.1.0", features = ["full"] }
```
## Contributing
diff --git a/examples/config/from_entity/from_entity.rs b/examples/config/from_entity/from_entity.rs
index 9044509..5be3525 100644
--- a/examples/config/from_entity/from_entity.rs
+++ b/examples/config/from_entity/from_entity.rs
@@ -1,13 +1,13 @@
+use sentinel_core::config::ConfigEntity;
+use sentinel_core::utils::sleep_for_ms;
use sentinel_macros::flow;
-use sentinel_rs::config::ConfigEntity;
-use sentinel_rs::utils::sleep_for_ms;
fn main() {
// Init sentienl configurations from a ConfigEntity
let mut config = ConfigEntity::default();
config.config.app.app_name = String::from("ConfigEntityApp");
- sentinel_rs::init_with_config(config)
- .unwrap_or_else(|err| sentinel_rs::logging::error!("{:?}", err));
+ sentinel_core::init_with_config(config)
+ .unwrap_or_else(|err| sentinel_core::logging::error!("{:?}", err));
let mut handlers = Vec::new();
for _ in 0..20 {
@@ -27,6 +27,6 @@ fn main() {
#[flow(threshold = 10.0)]
fn task() {
- println!("{}: passed", sentinel_rs::utils::curr_time_millis());
+ println!("{}: passed", sentinel_core::utils::curr_time_millis());
sleep_for_ms(10);
}
diff --git a/examples/config/from_yaml/from_yaml.rs b/examples/config/from_yaml/from_yaml.rs
index 3ea7a79..7e1593a 100644
--- a/examples/config/from_yaml/from_yaml.rs
+++ b/examples/config/from_yaml/from_yaml.rs
@@ -1,12 +1,12 @@
use sentinel_macros::flow;
-use sentinel_rs::utils::sleep_for_ms;
+use sentinel_core::utils::sleep_for_ms;
fn main() {
// Init sentienl configurations from yaml file
let yaml_name = String::from("testdata/config/sentinel.yaml");
- sentinel_rs::init_with_config_file(yaml_name)
- .unwrap_or_else(|err| sentinel_rs::logging::error!("{:?}", err));
+ sentinel_core::init_with_config_file(yaml_name)
+ .unwrap_or_else(|err| sentinel_core::logging::error!("{:?}", err));
let mut handlers = Vec::new();
for _ in 0..20 {
@@ -26,6 +26,6 @@ fn main() {
#[flow(threshold = 10.0)]
fn task() {
- println!("{}: passed", sentinel_rs::utils::curr_time_millis());
+ println!("{}: passed", sentinel_core::utils::curr_time_millis());
sleep_for_ms(10);
}
diff --git a/examples/datasources/consul.rs b/examples/datasources/consul.rs
index a185222..d76be8a 100644
--- a/examples/datasources/consul.rs
+++ b/examples/datasources/consul.rs
@@ -1,6 +1,6 @@
#![allow(unreachable_code)]
use consul::{kv::KVPair, kv::KV, Client, Config, QueryOptions};
-use sentinel_rs::{
+use sentinel_core::{
base,
datasource::{
ds_consul::ConsulDataSource, new_flow_rule_handler, rule_json_array_parser, DataSource,
@@ -38,7 +38,7 @@ fn main() -> Result<()> {
}
// Sleep 3 seconds and then read the consul
- sentinel_rs::utils::sleep_for_ms(3000);
+ sentinel_core::utils::sleep_for_ms(3000);
// Create a data source and change the rule.
let h = new_flow_rule_handler(rule_json_array_parser);
@@ -52,7 +52,7 @@ fn main() -> Result<()> {
fn basic_flow_example() -> Vec> {
// Init sentienl configurations
- sentinel_rs::init_default().unwrap_or_else(|err| sentinel_rs::logging::error!("{:?}", err));
+ sentinel_core::init_default().unwrap_or_else(|err| sentinel_core::logging::error!("{:?}", err));
let resource_name = String::from("task");
// Load sentinel rules
flow::load_rules(vec![Arc::new(flow::Rule {
@@ -86,6 +86,6 @@ fn basic_flow_example() -> Vec> {
// todo: Cannot sentinel-macros now. It will append rules,
// which is conflicts with the dynamic datasource
fn task() {
- println!("{}: passed", sentinel_rs::utils::curr_time_millis());
+ println!("{}: passed", sentinel_core::utils::curr_time_millis());
sleep_for_ms(100);
}
diff --git a/examples/datasources/etcdv3.rs b/examples/datasources/etcdv3.rs
index 1be9312..fc5f5cd 100644
--- a/examples/datasources/etcdv3.rs
+++ b/examples/datasources/etcdv3.rs
@@ -1,6 +1,6 @@
#![allow(unreachable_code)]
use etcd_rs::{Client, ClientConfig, PutRequest};
-use sentinel_rs::{
+use sentinel_core::{
base,
datasource::{
ds_etcdv3::Etcdv3DataSource, new_flow_rule_handler, rule_json_array_parser, DataSource,
@@ -41,7 +41,7 @@ async fn main() -> Result<()> {
}
// Sleep 3 seconds and then read the etcd
- sentinel_rs::utils::sleep_for_ms(3000);
+ sentinel_core::utils::sleep_for_ms(3000);
// Create a data source and change the rule.
let h = new_flow_rule_handler(rule_json_array_parser);
@@ -55,7 +55,7 @@ async fn main() -> Result<()> {
async fn basic_flow_example() -> Vec> {
// Init sentienl configurations
- sentinel_rs::init_default().unwrap_or_else(|err| sentinel_rs::logging::error!("{:?}", err));
+ sentinel_core::init_default().unwrap_or_else(|err| sentinel_core::logging::error!("{:?}", err));
let resource_name = String::from("task");
// Load sentinel rules
flow::load_rules(vec![Arc::new(flow::Rule {
@@ -89,6 +89,6 @@ async fn basic_flow_example() -> Vec> {
// todo: Cannot sentinel-macros now. It will append rules,
// which is conflicts with the dynamic datasource
async fn task() {
- println!("{}: passed", sentinel_rs::utils::curr_time_millis());
+ println!("{}: passed", sentinel_core::utils::curr_time_millis());
sleep(Duration::from_millis(100)).await;
}
diff --git a/examples/datasources/k8s.rs b/examples/datasources/k8s.rs
index b06b819..4647026 100644
--- a/examples/datasources/k8s.rs
+++ b/examples/datasources/k8s.rs
@@ -5,7 +5,7 @@ use kube::{
runtime::wait::{await_condition, conditions},
Client, CustomResourceExt,
};
-use sentinel_rs::{
+use sentinel_core::{
base,
datasource::{
ds_k8s::{K8sDataSource, SENTINEL_RULE_GROUP},
@@ -44,7 +44,7 @@ async fn main() -> Result<()> {
}
// Sleep 3 seconds and then read the change of CRD
- sentinel_rs::utils::sleep_for_ms(3000);
+ sentinel_core::utils::sleep_for_ms(3000);
// Create a data source and change the rule.
let h = new_flow_rule_handler(rule_json_array_parser);
@@ -64,7 +64,7 @@ async fn main() -> Result<()> {
async fn basic_flow_example() -> Vec> {
// Init sentienl configurations
- sentinel_rs::init_default().unwrap_or_else(|err| sentinel_rs::logging::error!("{:?}", err));
+ sentinel_core::init_default().unwrap_or_else(|err| sentinel_core::logging::error!("{:?}", err));
let resource_name = String::from("task");
// Load sentinel rules
flow::load_rules(vec![Arc::new(flow::Rule {
@@ -98,7 +98,7 @@ async fn basic_flow_example() -> Vec> {
// todo: Cannot sentinel-macros now. It will append rules,
// which is conflicts with the dynamic datasource
async fn task() {
- println!("{}: passed", sentinel_rs::utils::curr_time_millis());
+ println!("{}: passed", sentinel_core::utils::curr_time_millis());
sleep(Duration::from_millis(100)).await;
}
diff --git a/examples/ebpf/userspace/Cargo.toml b/examples/ebpf/userspace/Cargo.toml
index edc3968..361f833 100644
--- a/examples/ebpf/userspace/Cargo.toml
+++ b/examples/ebpf/userspace/Cargo.toml
@@ -11,7 +11,7 @@ redbpf = { version = "2.3.0", features = ["load"] }
futures = "0.3"
tracing = "0.1.26"
tracing-subscriber = "0.3.3"
-sentinel-rs = { version = "0.1.0", path = "../../../sentinel", features = ["full"] }
+sentinel-core = { version = "0.1.0", path = "../../../sentinel-core", features = ["full"] }
[build-dependencies]
cargo-bpf = { version = "2.3.0", default-features = false, features = ["build", "llvm-sys-130"] }
diff --git a/examples/ebpf/userspace/src/port.rs b/examples/ebpf/userspace/src/port.rs
index ecd64a2..44b5b29 100644
--- a/examples/ebpf/userspace/src/port.rs
+++ b/examples/ebpf/userspace/src/port.rs
@@ -1,7 +1,7 @@
use futures::stream::StreamExt;
use probes::port::PortEvent;
use redbpf::{load::Loader, xdp, Array};
-use sentinel_rs::{base, flow, EntryBuilder};
+use sentinel_core::{base, flow, EntryBuilder};
use std::sync::Arc;
use tracing::Level;
use tracing_subscriber::FmtSubscriber;
@@ -16,7 +16,7 @@ fn probe_code() -> &'static [u8] {
#[tokio::main(flavor = "current_thread")]
async fn main() -> std::result::Result<(), String> {
// initialize sentinel
- sentinel_rs::init_default().unwrap_or_else(|err| sentinel_rs::logging::error!("{:?}", err));
+ sentinel_core::init_default().unwrap_or_else(|err| sentinel_core::logging::error!("{:?}", err));
flow::load_rules(vec![Arc::new(flow::Rule {
resource: "port:8000".into(),
threshold: 1.0,
@@ -68,7 +68,7 @@ async fn main() -> std::result::Result<(), String> {
println!(
"{} at {} passed",
res_name,
- sentinel_rs::utils::curr_time_millis()
+ sentinel_core::utils::curr_time_millis()
);
}
entry.exit()
@@ -79,7 +79,7 @@ async fn main() -> std::result::Result<(), String> {
println!(
"{} at {} blocked",
res_name,
- sentinel_rs::utils::curr_time_millis()
+ sentinel_core::utils::curr_time_millis()
);
}
}
diff --git a/examples/exporter/prometheus/prometheus.rs b/examples/exporter/prometheus/prometheus.rs
index a4c8dc4..7e2d9d6 100644
--- a/examples/exporter/prometheus/prometheus.rs
+++ b/examples/exporter/prometheus/prometheus.rs
@@ -1,10 +1,10 @@
use rand::prelude::*;
-use sentinel_macros::{circuitbreaker, flow};
-use sentinel_rs::base::Snapshot;
-use sentinel_rs::circuitbreaker::{
+use sentinel_core::base::Snapshot;
+use sentinel_core::circuitbreaker::{
register_state_change_listeners, Rule, State, StateChangeListener,
};
-use sentinel_rs::utils::{curr_time_millis, sleep_for_ms};
+use sentinel_core::utils::{curr_time_millis, sleep_for_ms};
+use sentinel_macros::{circuitbreaker, flow};
use std::sync::Arc;
struct MyStateListener {}
@@ -34,7 +34,7 @@ impl StateChangeListener for MyStateListener {
/// slow-request circuit breaking example with Sentinel attributes macros
fn main() {
// Init sentienl configurations
- sentinel_rs::init_default().unwrap_or_else(|err| sentinel_rs::logging::error!("{:?}", err));
+ sentinel_core::init_default().unwrap_or_else(|err| sentinel_core::logging::error!("{:?}", err));
let listeners: Vec> = vec![Arc::new(MyStateListener {})];
register_state_change_listeners(listeners);
@@ -74,7 +74,7 @@ fn main() {
stat_sliding_window_bucket_count = 10
)]
fn task1() {
- println!("{}: passed", sentinel_rs::utils::curr_time_millis());
+ println!("{}: passed", sentinel_core::utils::curr_time_millis());
let uzi = (thread_rng().gen::() * 10.0).round() as u64;
sleep_for_ms(uzi);
}
@@ -87,6 +87,6 @@ fn task1() {
warm_up_cold_factor = 3
)]
fn task2() {
- println!("{}: passed", sentinel_rs::utils::curr_time_millis());
+ println!("{}: passed", sentinel_core::utils::curr_time_millis());
sleep_for_ms(10);
}
diff --git a/examples/proxy/envoy/Cargo.toml b/examples/proxy/envoy/Cargo.toml
index b1e404b..71774c6 100644
--- a/examples/proxy/envoy/Cargo.toml
+++ b/examples/proxy/envoy/Cargo.toml
@@ -2,6 +2,7 @@
name = "sentinel-envoy-module"
version = "0.1.0"
edition = "2021"
+publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@@ -10,6 +11,7 @@ path = "src/lib.rs"
crate-type = ["cdylib"]
[dependencies]
-sentinel-rs = { version = "0.1.0", path = "../../../sentinel", features = ["full", "proxy_envoy"] }
+sentinel-core = { version = "0.1.0", path = "../../../sentinel-core", features = ["full", "proxy_envoy"] }
+
proxy-wasm = "0.1.4"
log = "0.4"
diff --git a/examples/proxy/envoy/src/lib.rs b/examples/proxy/envoy/src/lib.rs
index 03f3566..281d5dd 100644
--- a/examples/proxy/envoy/src/lib.rs
+++ b/examples/proxy/envoy/src/lib.rs
@@ -25,10 +25,10 @@ impl HttpContext for FlowAuthorizer {
match self.get_http_request_header("user") {
Some(token) if &token == "Cat" => {
- // sentinel_rs::system_metric::init_cpu_collector(1000); // would panic, same as follows
- // sentinel_rs::utils::sleep_for_ms(1000); // would panic since wasm did not support thread sleep
- let _builder = sentinel_rs::EntryBuilder::new(token)
- .with_traffic_type(sentinel_rs::base::TrafficType::Inbound);
+ // sentinel_core::system_metric::init_cpu_collector(1000); // would panic, same as follows
+ // sentinel_core::utils::sleep_for_ms(1000); // would panic since wasm did not support thread sleep
+ let _builder = sentinel_core::EntryBuilder::new(token)
+ .with_traffic_type(sentinel_core::base::TrafficType::Inbound);
/*
if _builder.build().is_err() {
self.send_http_response(
diff --git a/examples/rules/circuit_breaker/error_count.rs b/examples/rules/circuit_breaker/error_count.rs
index b421d0f..03608a2 100644
--- a/examples/rules/circuit_breaker/error_count.rs
+++ b/examples/rules/circuit_breaker/error_count.rs
@@ -1,11 +1,11 @@
use anyhow::Error;
use rand::prelude::*;
-use sentinel_rs::base::{Snapshot, TrafficType};
-use sentinel_rs::circuitbreaker::{
+use sentinel_core::base::{Snapshot, TrafficType};
+use sentinel_core::circuitbreaker::{
load_rules, register_state_change_listeners, BreakerStrategy, Rule, State, StateChangeListener,
};
-use sentinel_rs::utils::{curr_time_millis, sleep_for_ms};
-use sentinel_rs::EntryBuilder;
+use sentinel_core::utils::{curr_time_millis, sleep_for_ms};
+use sentinel_core::EntryBuilder;
use std::sync::Arc;
struct MyStateListener {}
@@ -41,7 +41,7 @@ impl StateChangeListener for MyStateListener {
/// error-count circuit breaking example with explicit Sentinel entry builder
fn main() {
// Init sentienl configurations
- sentinel_rs::init_default().unwrap_or_else(|err| sentinel_rs::logging::error!("{:?}", err));
+ sentinel_core::init_default().unwrap_or_else(|err| sentinel_core::logging::error!("{:?}", err));
let listeners: Vec> = vec![Arc::new(MyStateListener {})];
register_state_change_listeners(listeners);
let resource_name = String::from("error_ratio_example");
@@ -67,7 +67,7 @@ fn main() {
EntryBuilder::new(res_name.clone()).with_traffic_type(TrafficType::Inbound);
if let Ok(entry) = entry_builder.build() {
// Passed, wrap the logic here.
- println!("{}: passed", sentinel_rs::utils::curr_time_millis());
+ println!("{}: passed", sentinel_core::utils::curr_time_millis());
sleep_for_ms(10);
if thread_rng().gen::() > 0.6 {
entry.set_err(Error::msg("Example"));
diff --git a/examples/rules/circuit_breaker/error_ratio.rs b/examples/rules/circuit_breaker/error_ratio.rs
index 7d56f61..a3f2323 100644
--- a/examples/rules/circuit_breaker/error_ratio.rs
+++ b/examples/rules/circuit_breaker/error_ratio.rs
@@ -1,11 +1,11 @@
use anyhow::Error;
use rand::prelude::*;
-use sentinel_rs::base::{Snapshot, TrafficType};
-use sentinel_rs::circuitbreaker::{
+use sentinel_core::base::{Snapshot, TrafficType};
+use sentinel_core::circuitbreaker::{
load_rules, register_state_change_listeners, BreakerStrategy, Rule, State, StateChangeListener,
};
-use sentinel_rs::utils::{curr_time_millis, sleep_for_ms};
-use sentinel_rs::EntryBuilder;
+use sentinel_core::utils::{curr_time_millis, sleep_for_ms};
+use sentinel_core::EntryBuilder;
use std::sync::Arc;
struct MyStateListener {}
@@ -41,7 +41,7 @@ impl StateChangeListener for MyStateListener {
/// error-ratio circuit breaking example with explicit Sentinel entry builder
fn main() {
// Init sentienl configurations
- sentinel_rs::init_default().unwrap_or_else(|err| sentinel_rs::logging::error!("{:?}", err));
+ sentinel_core::init_default().unwrap_or_else(|err| sentinel_core::logging::error!("{:?}", err));
let listeners: Vec> = vec![Arc::new(MyStateListener {})];
register_state_change_listeners(listeners);
let resource_name = String::from("error_ratio_example");
@@ -67,7 +67,7 @@ fn main() {
EntryBuilder::new(res_name.clone()).with_traffic_type(TrafficType::Inbound);
if let Ok(entry) = entry_builder.build() {
// Passed, wrap the logic here.
- println!("{}: passed", sentinel_rs::utils::curr_time_millis());
+ println!("{}: passed", sentinel_core::utils::curr_time_millis());
sleep_for_ms(10);
if thread_rng().gen::() > 0.6 {
entry.set_err(Error::msg("Example"));
diff --git a/examples/rules/circuit_breaker/slow_request.rs b/examples/rules/circuit_breaker/slow_request.rs
index 4d508b4..b99cdf6 100644
--- a/examples/rules/circuit_breaker/slow_request.rs
+++ b/examples/rules/circuit_breaker/slow_request.rs
@@ -1,12 +1,12 @@
#![allow(clippy::needless_update)]
use rand::prelude::*;
-use sentinel_macros::circuitbreaker;
-use sentinel_rs::base::Snapshot;
-use sentinel_rs::circuitbreaker::{
+use sentinel_core::base::Snapshot;
+use sentinel_core::circuitbreaker::{
register_state_change_listeners, Rule, State, StateChangeListener,
};
-use sentinel_rs::utils::{curr_time_millis, sleep_for_ms};
+use sentinel_core::utils::{curr_time_millis, sleep_for_ms};
+use sentinel_macros::circuitbreaker;
use std::sync::Arc;
struct MyStateListener {}
@@ -36,7 +36,7 @@ impl StateChangeListener for MyStateListener {
/// slow-request circuit breaking example with Sentinel attributes macros
fn main() {
// Init sentienl configurations
- sentinel_rs::init_default().unwrap_or_else(|err| sentinel_rs::logging::error!("{:?}", err));
+ sentinel_core::init_default().unwrap_or_else(|err| sentinel_core::logging::error!("{:?}", err));
let listeners: Vec> = vec![Arc::new(MyStateListener {})];
register_state_change_listeners(listeners);
@@ -66,7 +66,7 @@ fn main() {
stat_sliding_window_bucket_count = 10
)]
fn task() {
- println!("{}: passed", sentinel_rs::utils::curr_time_millis());
+ println!("{}: passed", sentinel_core::utils::curr_time_millis());
let uzi = (thread_rng().gen::() * 10.0).round() as u64;
sleep_for_ms(uzi);
}
diff --git a/examples/rules/flow/hello_world.rs b/examples/rules/flow/hello_world.rs
index 640145d..a77b841 100644
--- a/examples/rules/flow/hello_world.rs
+++ b/examples/rules/flow/hello_world.rs
@@ -1,11 +1,11 @@
-use sentinel_rs::utils::sleep_for_ms;
-use sentinel_rs::{base, flow, EntryBuilder};
+use sentinel_core::utils::sleep_for_ms;
+use sentinel_core::{base, flow, EntryBuilder};
use std::sync::Arc;
/// a "hello-world" example on small code snippets with explicit Sentinel entry builders
fn main() {
// Init sentienl configurations
- sentinel_rs::init_default().unwrap_or_else(|err| sentinel_rs::logging::error!("{:?}", err));
+ sentinel_core::init_default().unwrap_or_else(|err| sentinel_core::logging::error!("{:?}", err));
let resource_name = String::from("direct_reject_flow_control_example");
// Load sentinel rules
@@ -25,7 +25,7 @@ fn main() {
.with_traffic_type(base::TrafficType::Inbound);
if let Ok(entry) = entry_builder.build() {
// Passed, wrap the logic here.
- println!("{}: passed", sentinel_rs::utils::curr_time_millis());
+ println!("{}: passed", sentinel_core::utils::curr_time_millis());
sleep_for_ms(rand::random::() % 10);
// Be sure the entry is exited finally.
entry.exit()
diff --git a/examples/rules/flow/macro.rs b/examples/rules/flow/macro.rs
index 19dbb94..9ed67ff 100644
--- a/examples/rules/flow/macro.rs
+++ b/examples/rules/flow/macro.rs
@@ -1,11 +1,11 @@
use sentinel_macros::flow;
-use sentinel_rs::utils::sleep_for_ms;
+use sentinel_core::utils::sleep_for_ms;
/// a "hello-world" example on small code snippets with Sentinel attributes macros
fn main() {
// Init sentienl configurations
- sentinel_rs::init_default().unwrap_or_else(|err| sentinel_rs::logging::error!("{:?}", err));
+ sentinel_core::init_default().unwrap_or_else(|err| sentinel_core::logging::error!("{:?}", err));
let mut handlers = Vec::new();
for _ in 0..20 {
@@ -31,6 +31,6 @@ fn main() {
warm_up_cold_factor = 3
)]
fn task() {
- println!("{}: passed", sentinel_rs::utils::curr_time_millis());
+ println!("{}: passed", sentinel_core::utils::curr_time_millis());
sleep_for_ms(10);
}
diff --git a/examples/rules/flow/memory_adaptive.rs b/examples/rules/flow/memory_adaptive.rs
index 78df2c2..30a89cd 100644
--- a/examples/rules/flow/memory_adaptive.rs
+++ b/examples/rules/flow/memory_adaptive.rs
@@ -1,11 +1,11 @@
use sentinel_macros::flow;
-use sentinel_rs::utils::sleep_for_ms;
+use sentinel_core::utils::sleep_for_ms;
/// an example on `flow::CalculateStrategy::MemoryAdaptive`
fn main() {
// Init sentienl configurations
- sentinel_rs::init_default().unwrap_or_else(|err| sentinel_rs::logging::error!("{:?}", err));
+ sentinel_core::init_default().unwrap_or_else(|err| sentinel_core::logging::error!("{:?}", err));
let mut handlers = Vec::new();
for _ in 0..20 {
@@ -32,6 +32,6 @@ fn main() {
high_mem_usage_threshold = 1
)]
fn task() {
- println!("{}: passed", sentinel_rs::utils::curr_time_millis());
+ println!("{}: passed", sentinel_core::utils::curr_time_millis());
sleep_for_ms(10);
}
diff --git a/examples/rules/flow/method.rs b/examples/rules/flow/method.rs
index 11774dc..ed54a86 100644
--- a/examples/rules/flow/method.rs
+++ b/examples/rules/flow/method.rs
@@ -1,12 +1,12 @@
use sentinel_macros::flow;
-use sentinel_rs::utils::sleep_for_ms;
+use sentinel_core::utils::sleep_for_ms;
use std::sync::Arc;
/// a "hello-world" example on small code snippets with Sentinel attributes macros
fn main() {
// Init sentienl configurations
- sentinel_rs::init_default().unwrap_or_else(|err| sentinel_rs::logging::error!("{:?}", err));
+ sentinel_core::init_default().unwrap_or_else(|err| sentinel_core::logging::error!("{:?}", err));
let mut handlers = Vec::new();
let db = Arc::new(DB {});
diff --git a/examples/rules/flow/throttling.rs b/examples/rules/flow/throttling.rs
index 3384918..39eec73 100644
--- a/examples/rules/flow/throttling.rs
+++ b/examples/rules/flow/throttling.rs
@@ -1,11 +1,11 @@
use sentinel_macros::flow;
-use sentinel_rs::utils::sleep_for_ms;
+use sentinel_core::utils::sleep_for_ms;
/// an example on `flow::ControlStrategy::Throttling`
fn main() {
// Init sentienl configurations
- sentinel_rs::init_default().unwrap_or_else(|err| sentinel_rs::logging::error!("{:?}", err));
+ sentinel_core::init_default().unwrap_or_else(|err| sentinel_core::logging::error!("{:?}", err));
let mut handlers = Vec::new();
for _ in 0..20 {
@@ -25,6 +25,6 @@ fn main() {
#[flow(control_strategy = "Throttling", threshold = 10.0)]
fn task() {
- println!("{}: passed", sentinel_rs::utils::curr_time_millis());
+ println!("{}: passed", sentinel_core::utils::curr_time_millis());
sleep_for_ms(10);
}
diff --git a/examples/rules/flow/tokio.rs b/examples/rules/flow/tokio.rs
index a14d656..42cb02c 100644
--- a/examples/rules/flow/tokio.rs
+++ b/examples/rules/flow/tokio.rs
@@ -6,14 +6,14 @@ use tokio::time::{sleep, Duration};
#[tokio::main]
async fn main() {
// Init sentienl configurations
- sentinel_rs::init_default().unwrap_or_else(|err| sentinel_rs::logging::error!("{:?}", err));
+ sentinel_core::init_default().unwrap_or_else(|err| sentinel_core::logging::error!("{:?}", err));
let mut handlers = Vec::new();
for _ in 0..20 {
handlers.push(tokio::spawn(async move {
loop {
task().await.unwrap_or_else(|_| {
- sentinel_rs::utils::sleep_for_ms(100);
+ sentinel_core::utils::sleep_for_ms(100);
});
}
}));
@@ -25,6 +25,6 @@ async fn main() {
#[flow(threshold = 10.0)]
async fn task() {
- println!("{}: passed", sentinel_rs::utils::curr_time_millis());
+ println!("{}: passed", sentinel_core::utils::curr_time_millis());
sleep(Duration::from_millis(100)).await;
}
diff --git a/examples/rules/hotspot/concurrency.rs b/examples/rules/hotspot/concurrency.rs
index ee54506..46f1108 100644
--- a/examples/rules/hotspot/concurrency.rs
+++ b/examples/rules/hotspot/concurrency.rs
@@ -1,12 +1,12 @@
+use sentinel_core::base::{ConcurrencyStat, ResourceType};
+use sentinel_core::stat::get_or_create_resource_node;
+use sentinel_core::utils::sleep_for_ms;
use sentinel_macros::hotspot;
-use sentinel_rs::base::{ConcurrencyStat, ResourceType};
-use sentinel_rs::stat::get_or_create_resource_node;
-use sentinel_rs::utils::sleep_for_ms;
/// a "hello-world" example on small code snippets with Sentinel attributes macros
fn main() {
// Init sentienl configurations
- sentinel_rs::init_default().unwrap_or_else(|err| sentinel_rs::logging::error!("{:?}", err));
+ sentinel_core::init_default().unwrap_or_else(|err| sentinel_core::logging::error!("{:?}", err));
let mut handlers = Vec::new();
for _ in 0..20 {
@@ -41,6 +41,6 @@ fn main() {
args = r#"vec!["task".into()]"#
)]
fn task() {
- println!("{}: passed", sentinel_rs::utils::curr_time_millis());
+ println!("{}: passed", sentinel_core::utils::curr_time_millis());
sleep_for_ms(10);
}
diff --git a/examples/rules/hotspot/qps_reject.rs b/examples/rules/hotspot/qps_reject.rs
index c9fd91e..812c19a 100644
--- a/examples/rules/hotspot/qps_reject.rs
+++ b/examples/rules/hotspot/qps_reject.rs
@@ -1,12 +1,12 @@
+use sentinel_core::base::{MetricEvent, ReadStat, ResourceType};
+use sentinel_core::stat::get_or_create_resource_node;
+use sentinel_core::utils::sleep_for_ms;
use sentinel_macros::hotspot;
-use sentinel_rs::base::{MetricEvent, ReadStat, ResourceType};
-use sentinel_rs::stat::get_or_create_resource_node;
-use sentinel_rs::utils::sleep_for_ms;
/// a "hello-world" example on small code snippets with Sentinel attributes macros
fn main() {
// Init sentienl configurations
- sentinel_rs::init_default().unwrap_or_else(|err| sentinel_rs::logging::error!("{:?}", err));
+ sentinel_core::init_default().unwrap_or_else(|err| sentinel_core::logging::error!("{:?}", err));
let mut handlers = Vec::new();
for _ in 0..20 {
@@ -46,6 +46,6 @@ fn main() {
args = r#"vec!["task1".into(),"task2".into()]"#
)]
fn task() {
- println!("{}: passed", sentinel_rs::utils::curr_time_millis());
+ println!("{}: passed", sentinel_core::utils::curr_time_millis());
sleep_for_ms(10);
}
diff --git a/examples/rules/hotspot/qps_throttling.rs b/examples/rules/hotspot/qps_throttling.rs
index 15cc187..100a350 100644
--- a/examples/rules/hotspot/qps_throttling.rs
+++ b/examples/rules/hotspot/qps_throttling.rs
@@ -1,12 +1,12 @@
+use sentinel_core::base::{MetricEvent, ReadStat, ResourceType};
+use sentinel_core::stat::get_or_create_resource_node;
+use sentinel_core::utils::sleep_for_ms;
use sentinel_macros::hotspot;
-use sentinel_rs::base::{MetricEvent, ReadStat, ResourceType};
-use sentinel_rs::stat::get_or_create_resource_node;
-use sentinel_rs::utils::sleep_for_ms;
/// a "hello-world" example on small code snippets with Sentinel attributes macros
fn main() {
// Init sentienl configurations
- sentinel_rs::init_default().unwrap_or_else(|err| sentinel_rs::logging::error!("{:?}", err));
+ sentinel_core::init_default().unwrap_or_else(|err| sentinel_core::logging::error!("{:?}", err));
let mut handlers = Vec::new();
for _ in 0..20 {
@@ -46,6 +46,6 @@ fn main() {
args = r#"vec!["task".into()]"#
)]
fn task() {
- println!("{}: passed", sentinel_rs::utils::curr_time_millis());
+ println!("{}: passed", sentinel_core::utils::curr_time_millis());
sleep_for_ms(10);
}
diff --git a/examples/rules/isolation/concurrency.rs b/examples/rules/isolation/concurrency.rs
index 8785381..8e1fa5a 100644
--- a/examples/rules/isolation/concurrency.rs
+++ b/examples/rules/isolation/concurrency.rs
@@ -1,13 +1,13 @@
#![allow(clippy::needless_update)]
+use sentinel_core::base::{ConcurrencyStat, ResourceType};
+use sentinel_core::stat::get_or_create_resource_node;
+use sentinel_core::utils::sleep_for_ms;
use sentinel_macros::isolation;
-use sentinel_rs::base::{ConcurrencyStat, ResourceType};
-use sentinel_rs::stat::get_or_create_resource_node;
-use sentinel_rs::utils::sleep_for_ms;
/// a "hello-world" example on small code snippets with Sentinel attributes macros
fn main() {
// Init sentienl configurations
- sentinel_rs::init_default().unwrap_or_else(|err| sentinel_rs::logging::error!("{:?}", err));
+ sentinel_core::init_default().unwrap_or_else(|err| sentinel_core::logging::error!("{:?}", err));
let mut handlers = Vec::new();
for _ in 0..20 {
@@ -37,6 +37,6 @@ fn main() {
#[isolation(threshold = 3, metric_type = "Concurrency")]
fn task() {
- println!("{}: passed", sentinel_rs::utils::curr_time_millis());
+ println!("{}: passed", sentinel_core::utils::curr_time_millis());
sleep_for_ms(10);
}
diff --git a/examples/rules/system/avg_rt.rs b/examples/rules/system/avg_rt.rs
index 0c18ea5..dbf46da 100644
--- a/examples/rules/system/avg_rt.rs
+++ b/examples/rules/system/avg_rt.rs
@@ -1,11 +1,11 @@
#![allow(clippy::needless_update)]
+use sentinel_core::utils::sleep_for_ms;
use sentinel_macros::system;
-use sentinel_rs::utils::sleep_for_ms;
/// a "hello-world" example on small code snippets with Sentinel attributes macros
fn main() {
// Init sentienl configurations
- sentinel_rs::init_default().unwrap_or_else(|err| sentinel_rs::logging::error!("{:?}", err));
+ sentinel_core::init_default().unwrap_or_else(|err| sentinel_core::logging::error!("{:?}", err));
let mut handlers = Vec::new();
for _ in 0..20 {
@@ -29,6 +29,6 @@ fn main() {
adaptive_strategy = "NoAdaptive"
)]
fn task() {
- println!("{}: passed", sentinel_rs::utils::curr_time_millis());
+ println!("{}: passed", sentinel_core::utils::curr_time_millis());
sleep_for_ms(10);
}
diff --git a/examples/rules/system/concurrency.rs b/examples/rules/system/concurrency.rs
index 94993ba..706096a 100644
--- a/examples/rules/system/concurrency.rs
+++ b/examples/rules/system/concurrency.rs
@@ -1,13 +1,13 @@
#![allow(clippy::needless_update)]
+use sentinel_core::base::{ConcurrencyStat, ResourceType};
+use sentinel_core::stat::get_or_create_resource_node;
+use sentinel_core::utils::sleep_for_ms;
use sentinel_macros::system;
-use sentinel_rs::base::{ConcurrencyStat, ResourceType};
-use sentinel_rs::stat::get_or_create_resource_node;
-use sentinel_rs::utils::sleep_for_ms;
/// a "hello-world" example on small code snippets with Sentinel attributes macros
fn main() {
// Init sentienl configurations
- sentinel_rs::init_default().unwrap_or_else(|err| sentinel_rs::logging::error!("{:?}", err));
+ sentinel_core::init_default().unwrap_or_else(|err| sentinel_core::logging::error!("{:?}", err));
let mut handlers = Vec::new();
for _ in 0..20 {
@@ -42,6 +42,6 @@ fn main() {
adaptive_strategy = "NoAdaptive"
)]
fn task() {
- println!("{}: passed", sentinel_rs::utils::curr_time_millis());
+ println!("{}: passed", sentinel_core::utils::curr_time_millis());
sleep_for_ms(10);
}
diff --git a/examples/rules/system/cpu_usage.rs b/examples/rules/system/cpu_usage.rs
index bf9d00a..7125fb6 100644
--- a/examples/rules/system/cpu_usage.rs
+++ b/examples/rules/system/cpu_usage.rs
@@ -1,12 +1,12 @@
#![allow(clippy::needless_update)]
+use sentinel_core::utils::sleep_for_ms;
use sentinel_macros::system;
-use sentinel_rs::utils::sleep_for_ms;
/// a "hello-world" example on small code snippets with Sentinel attributes macros
fn main() {
// Init sentienl configurations
- // sentinel_rs::init_default().unwrap_or_else(|err| sentinel_rs::logging::error!("{:?}", err));
- sentinel_rs::init_default().unwrap();
+ // sentinel_core::init_default().unwrap_or_else(|err| sentinel_core::logging::error!("{:?}", err));
+ sentinel_core::init_default().unwrap();
let mut handlers = Vec::new();
for _ in 0..20 {
@@ -30,6 +30,6 @@ fn main() {
adaptive_strategy = "NoAdaptive"
)]
fn task() {
- println!("{}: passed", sentinel_rs::utils::curr_time_millis());
+ println!("{}: passed", sentinel_core::utils::curr_time_millis());
sleep_for_ms(10);
}
diff --git a/examples/rules/system/inbound_qps.rs b/examples/rules/system/inbound_qps.rs
index cf6fe70..5ad8863 100644
--- a/examples/rules/system/inbound_qps.rs
+++ b/examples/rules/system/inbound_qps.rs
@@ -1,11 +1,11 @@
#![allow(clippy::needless_update)]
+use sentinel_core::utils::sleep_for_ms;
use sentinel_macros::system;
-use sentinel_rs::utils::sleep_for_ms;
/// a "hello-world" example on small code snippets with Sentinel attributes macros
fn main() {
// Init sentienl configurations
- sentinel_rs::init_default().unwrap_or_else(|err| sentinel_rs::logging::error!("{:?}", err));
+ sentinel_core::init_default().unwrap_or_else(|err| sentinel_core::logging::error!("{:?}", err));
let mut handlers = Vec::new();
for _ in 0..20 {
@@ -30,6 +30,6 @@ fn main() {
adaptive_strategy = "NoAdaptive"
)]
fn task() {
- println!("{}: passed", sentinel_rs::utils::curr_time_millis());
+ println!("{}: passed", sentinel_core::utils::curr_time_millis());
sleep_for_ms(10);
}
diff --git a/examples/rules/system/load.rs b/examples/rules/system/load.rs
index 7c0798f..6737db2 100644
--- a/examples/rules/system/load.rs
+++ b/examples/rules/system/load.rs
@@ -1,11 +1,11 @@
#![allow(clippy::needless_update)]
+use sentinel_core::utils::sleep_for_ms;
use sentinel_macros::system;
-use sentinel_rs::utils::sleep_for_ms;
/// a "hello-world" example on small code snippets with Sentinel attributes macros
fn main() {
// Init sentienl configurations
- sentinel_rs::init_default().unwrap_or_else(|err| sentinel_rs::logging::error!("{:?}", err));
+ sentinel_core::init_default().unwrap_or_else(|err| sentinel_core::logging::error!("{:?}", err));
let mut handlers = Vec::new();
for _ in 0..20 {
@@ -29,6 +29,6 @@ fn main() {
adaptive_strategy = "NoAdaptive"
)]
fn task() {
- println!("{}: passed", sentinel_rs::utils::curr_time_millis());
+ println!("{}: passed", sentinel_core::utils::curr_time_millis());
sleep_for_ms(10);
}
diff --git a/grc.toml b/grc.toml
index f0076e8..c459e3c 100644
--- a/grc.toml
+++ b/grc.toml
@@ -2,7 +2,7 @@ emoji = true
pre = [
"make fmt",
- "cp ./README.md ./sentinel/README.md",
+ "cp ./README.md ./sentinel-core/README.md",
"echo 'preliminary done'",
]
diff --git a/sentinel/Cargo.toml b/sentinel-core/Cargo.toml
similarity index 98%
rename from sentinel/Cargo.toml
rename to sentinel-core/Cargo.toml
index b3fd22d..5e4cf21 100644
--- a/sentinel/Cargo.toml
+++ b/sentinel-core/Cargo.toml
@@ -1,11 +1,11 @@
[package]
-name = "sentinel-rs"
+name = "sentinel-core"
version = "0.1.0"
authors = ["Forsworns <378974295@qq.com>"]
edition = "2018"
license = "Apache-2.0"
readme = "README.md"
-documentation = "https://docs.rs/sentinel-rs/latest"
+documentation = "https://docs.rs/sentinel-core/latest"
repository = "https://github.com/sentinel-group/sentinel-rust"
homepage = "https://sentinelguard.io/en-us/"
description = """
diff --git a/sentinel/LICENSE b/sentinel-core/LICENSE
similarity index 100%
rename from sentinel/LICENSE
rename to sentinel-core/LICENSE
diff --git a/sentinel/README.md b/sentinel-core/README.md
similarity index 89%
rename from sentinel/README.md
rename to sentinel-core/README.md
index 84d1b8d..17eea93 100644
--- a/sentinel/README.md
+++ b/sentinel-core/README.md
@@ -1,6 +1,6 @@
-# Sentinel: The Sentinel of Your Microservices (WIP)
+# Sentinel: The Sentinel of Your Microservices
[![Crates.io][crates-badge]][crates-url]
[![Sentinel CI][ci-badge]][ci-url]
@@ -9,8 +9,8 @@
[![Gitter chat][gitter-badge]][gitter-url]
-[crates-badge]: https://img.shields.io/crates/v/sentinel-rs.svg
-[crates-url]: https://crates.io/crates/sentinel-rs
+[crates-badge]: https://img.shields.io/crates/v/sentinel.svg
+[crates-url]: https://crates.io/crates/sentinel-core
[ci-badge]: https://github.com/sentinel-group/sentinel-rust/actions/workflows/ci.yml/badge.svg
[ci-url]: https://github.com/sentinel-group/sentinel-rust/actions/workflows/ci.yml
[codecov-badge]: https://codecov.io/gh/sentinel-group/sentinel-rust/branch/main/graph/badge.svg
@@ -41,7 +41,7 @@ See the [Sentinel](https://sentinelguard.io/en-us/) for the document website.
See the [中文文档](https://sentinelguard.io/zh-cn/) for document in Chinese.
-The [Rust API documentation](https://docs.rs/sentinel-rs/latest) is working in progress.
+The [Rust API documentation](https://docs.rs/sentinel-core/latest) is working in progress.
## Example
@@ -49,7 +49,7 @@ Add the dependency in Cargo.toml:
```toml
[dependencies]
-sentinel-rs = { version = "0.1.0", features = ["full"] }
+sentinel-core = { version = "0.1.0", features = ["full"] }
```
## Contributing
diff --git a/sentinel/src/api/api.rs b/sentinel-core/src/api/api.rs
similarity index 100%
rename from sentinel/src/api/api.rs
rename to sentinel-core/src/api/api.rs
diff --git a/sentinel/src/api/init.rs b/sentinel-core/src/api/init.rs
similarity index 100%
rename from sentinel/src/api/init.rs
rename to sentinel-core/src/api/init.rs
diff --git a/sentinel/src/api/mod.rs b/sentinel-core/src/api/mod.rs
similarity index 97%
rename from sentinel/src/api/mod.rs
rename to sentinel-core/src/api/mod.rs
index 2fb53ac..5f448e7 100644
--- a/sentinel/src/api/mod.rs
+++ b/sentinel-core/src/api/mod.rs
@@ -1,4 +1,4 @@
-//! mod `api` provides the topmost fundamental APIs for users using sentinel-rs.
+//! mod `api` provides the topmost fundamental APIs for users using sentinel-core.
//! Users must initialize Sentinel before loading Sentinel rules. Sentinel support three ways to perform initialization:
//!
//! 1. `init_default()`, using default config to initialize.
diff --git a/sentinel/src/api/slot_chain.rs b/sentinel-core/src/api/slot_chain.rs
similarity index 100%
rename from sentinel/src/api/slot_chain.rs
rename to sentinel-core/src/api/slot_chain.rs
diff --git a/sentinel/src/core/base/block_error.rs b/sentinel-core/src/core/base/block_error.rs
similarity index 100%
rename from sentinel/src/core/base/block_error.rs
rename to sentinel-core/src/core/base/block_error.rs
diff --git a/sentinel/src/core/base/constant.rs b/sentinel-core/src/core/base/constant.rs
similarity index 100%
rename from sentinel/src/core/base/constant.rs
rename to sentinel-core/src/core/base/constant.rs
diff --git a/sentinel/src/core/base/context.rs b/sentinel-core/src/core/base/context.rs
similarity index 100%
rename from sentinel/src/core/base/context.rs
rename to sentinel-core/src/core/base/context.rs
diff --git a/sentinel/src/core/base/entry.rs b/sentinel-core/src/core/base/entry.rs
similarity index 100%
rename from sentinel/src/core/base/entry.rs
rename to sentinel-core/src/core/base/entry.rs
diff --git a/sentinel/src/core/base/metric_item.rs b/sentinel-core/src/core/base/metric_item.rs
similarity index 100%
rename from sentinel/src/core/base/metric_item.rs
rename to sentinel-core/src/core/base/metric_item.rs
diff --git a/sentinel/src/core/base/mod.rs b/sentinel-core/src/core/base/mod.rs
similarity index 100%
rename from sentinel/src/core/base/mod.rs
rename to sentinel-core/src/core/base/mod.rs
diff --git a/sentinel/src/core/base/resource.rs b/sentinel-core/src/core/base/resource.rs
similarity index 100%
rename from sentinel/src/core/base/resource.rs
rename to sentinel-core/src/core/base/resource.rs
diff --git a/sentinel/src/core/base/result.rs b/sentinel-core/src/core/base/result.rs
similarity index 100%
rename from sentinel/src/core/base/result.rs
rename to sentinel-core/src/core/base/result.rs
diff --git a/sentinel/src/core/base/rule.rs b/sentinel-core/src/core/base/rule.rs
similarity index 100%
rename from sentinel/src/core/base/rule.rs
rename to sentinel-core/src/core/base/rule.rs
diff --git a/sentinel/src/core/base/slot_chain.rs b/sentinel-core/src/core/base/slot_chain.rs
similarity index 100%
rename from sentinel/src/core/base/slot_chain.rs
rename to sentinel-core/src/core/base/slot_chain.rs
diff --git a/sentinel/src/core/base/stat.rs b/sentinel-core/src/core/base/stat.rs
similarity index 100%
rename from sentinel/src/core/base/stat.rs
rename to sentinel-core/src/core/base/stat.rs
diff --git a/sentinel/src/core/circuitbreaker/breaker/error_count.rs b/sentinel-core/src/core/circuitbreaker/breaker/error_count.rs
similarity index 100%
rename from sentinel/src/core/circuitbreaker/breaker/error_count.rs
rename to sentinel-core/src/core/circuitbreaker/breaker/error_count.rs
diff --git a/sentinel/src/core/circuitbreaker/breaker/error_ratio.rs b/sentinel-core/src/core/circuitbreaker/breaker/error_ratio.rs
similarity index 100%
rename from sentinel/src/core/circuitbreaker/breaker/error_ratio.rs
rename to sentinel-core/src/core/circuitbreaker/breaker/error_ratio.rs
diff --git a/sentinel/src/core/circuitbreaker/breaker/mod.rs b/sentinel-core/src/core/circuitbreaker/breaker/mod.rs
similarity index 100%
rename from sentinel/src/core/circuitbreaker/breaker/mod.rs
rename to sentinel-core/src/core/circuitbreaker/breaker/mod.rs
diff --git a/sentinel/src/core/circuitbreaker/breaker/slow_request.rs b/sentinel-core/src/core/circuitbreaker/breaker/slow_request.rs
similarity index 100%
rename from sentinel/src/core/circuitbreaker/breaker/slow_request.rs
rename to sentinel-core/src/core/circuitbreaker/breaker/slow_request.rs
diff --git a/sentinel/src/core/circuitbreaker/breaker/stat.rs b/sentinel-core/src/core/circuitbreaker/breaker/stat.rs
similarity index 100%
rename from sentinel/src/core/circuitbreaker/breaker/stat.rs
rename to sentinel-core/src/core/circuitbreaker/breaker/stat.rs
diff --git a/sentinel/src/core/circuitbreaker/mod.rs b/sentinel-core/src/core/circuitbreaker/mod.rs
similarity index 100%
rename from sentinel/src/core/circuitbreaker/mod.rs
rename to sentinel-core/src/core/circuitbreaker/mod.rs
diff --git a/sentinel/src/core/circuitbreaker/rule.rs b/sentinel-core/src/core/circuitbreaker/rule.rs
similarity index 100%
rename from sentinel/src/core/circuitbreaker/rule.rs
rename to sentinel-core/src/core/circuitbreaker/rule.rs
diff --git a/sentinel/src/core/circuitbreaker/rule_manager.rs b/sentinel-core/src/core/circuitbreaker/rule_manager.rs
similarity index 100%
rename from sentinel/src/core/circuitbreaker/rule_manager.rs
rename to sentinel-core/src/core/circuitbreaker/rule_manager.rs
diff --git a/sentinel/src/core/circuitbreaker/slot.rs b/sentinel-core/src/core/circuitbreaker/slot.rs
similarity index 100%
rename from sentinel/src/core/circuitbreaker/slot.rs
rename to sentinel-core/src/core/circuitbreaker/slot.rs
diff --git a/sentinel/src/core/circuitbreaker/stat_slot.rs b/sentinel-core/src/core/circuitbreaker/stat_slot.rs
similarity index 100%
rename from sentinel/src/core/circuitbreaker/stat_slot.rs
rename to sentinel-core/src/core/circuitbreaker/stat_slot.rs
diff --git a/sentinel/src/core/config/config.rs b/sentinel-core/src/core/config/config.rs
similarity index 100%
rename from sentinel/src/core/config/config.rs
rename to sentinel-core/src/core/config/config.rs
diff --git a/sentinel/src/core/config/constant.rs b/sentinel-core/src/core/config/constant.rs
similarity index 100%
rename from sentinel/src/core/config/constant.rs
rename to sentinel-core/src/core/config/constant.rs
diff --git a/sentinel/src/core/config/entity.rs b/sentinel-core/src/core/config/entity.rs
similarity index 100%
rename from sentinel/src/core/config/entity.rs
rename to sentinel-core/src/core/config/entity.rs
diff --git a/sentinel/src/core/config/mod.rs b/sentinel-core/src/core/config/mod.rs
similarity index 100%
rename from sentinel/src/core/config/mod.rs
rename to sentinel-core/src/core/config/mod.rs
diff --git a/sentinel/src/core/flow/mod.rs b/sentinel-core/src/core/flow/mod.rs
similarity index 100%
rename from sentinel/src/core/flow/mod.rs
rename to sentinel-core/src/core/flow/mod.rs
diff --git a/sentinel/src/core/flow/rule.rs b/sentinel-core/src/core/flow/rule.rs
similarity index 100%
rename from sentinel/src/core/flow/rule.rs
rename to sentinel-core/src/core/flow/rule.rs
diff --git a/sentinel/src/core/flow/rule_manager.rs b/sentinel-core/src/core/flow/rule_manager.rs
similarity index 100%
rename from sentinel/src/core/flow/rule_manager.rs
rename to sentinel-core/src/core/flow/rule_manager.rs
diff --git a/sentinel/src/core/flow/slot.rs b/sentinel-core/src/core/flow/slot.rs
similarity index 100%
rename from sentinel/src/core/flow/slot.rs
rename to sentinel-core/src/core/flow/slot.rs
diff --git a/sentinel/src/core/flow/standalone_stat_slot.rs b/sentinel-core/src/core/flow/standalone_stat_slot.rs
similarity index 100%
rename from sentinel/src/core/flow/standalone_stat_slot.rs
rename to sentinel-core/src/core/flow/standalone_stat_slot.rs
diff --git a/sentinel/src/core/flow/traffic_shaping/adaptive.rs b/sentinel-core/src/core/flow/traffic_shaping/adaptive.rs
similarity index 100%
rename from sentinel/src/core/flow/traffic_shaping/adaptive.rs
rename to sentinel-core/src/core/flow/traffic_shaping/adaptive.rs
diff --git a/sentinel/src/core/flow/traffic_shaping/default.rs b/sentinel-core/src/core/flow/traffic_shaping/default.rs
similarity index 100%
rename from sentinel/src/core/flow/traffic_shaping/default.rs
rename to sentinel-core/src/core/flow/traffic_shaping/default.rs
diff --git a/sentinel/src/core/flow/traffic_shaping/mod.rs b/sentinel-core/src/core/flow/traffic_shaping/mod.rs
similarity index 100%
rename from sentinel/src/core/flow/traffic_shaping/mod.rs
rename to sentinel-core/src/core/flow/traffic_shaping/mod.rs
diff --git a/sentinel/src/core/flow/traffic_shaping/throttling.rs b/sentinel-core/src/core/flow/traffic_shaping/throttling.rs
similarity index 100%
rename from sentinel/src/core/flow/traffic_shaping/throttling.rs
rename to sentinel-core/src/core/flow/traffic_shaping/throttling.rs
diff --git a/sentinel/src/core/flow/traffic_shaping/warmup.rs b/sentinel-core/src/core/flow/traffic_shaping/warmup.rs
similarity index 100%
rename from sentinel/src/core/flow/traffic_shaping/warmup.rs
rename to sentinel-core/src/core/flow/traffic_shaping/warmup.rs
diff --git a/sentinel/src/core/hotspot/cache.rs b/sentinel-core/src/core/hotspot/cache.rs
similarity index 100%
rename from sentinel/src/core/hotspot/cache.rs
rename to sentinel-core/src/core/hotspot/cache.rs
diff --git a/sentinel/src/core/hotspot/concurrency_stat_slot.rs b/sentinel-core/src/core/hotspot/concurrency_stat_slot.rs
similarity index 100%
rename from sentinel/src/core/hotspot/concurrency_stat_slot.rs
rename to sentinel-core/src/core/hotspot/concurrency_stat_slot.rs
diff --git a/sentinel/src/core/hotspot/mod.rs b/sentinel-core/src/core/hotspot/mod.rs
similarity index 100%
rename from sentinel/src/core/hotspot/mod.rs
rename to sentinel-core/src/core/hotspot/mod.rs
diff --git a/sentinel/src/core/hotspot/param_metric.rs b/sentinel-core/src/core/hotspot/param_metric.rs
similarity index 100%
rename from sentinel/src/core/hotspot/param_metric.rs
rename to sentinel-core/src/core/hotspot/param_metric.rs
diff --git a/sentinel/src/core/hotspot/rule.rs b/sentinel-core/src/core/hotspot/rule.rs
similarity index 100%
rename from sentinel/src/core/hotspot/rule.rs
rename to sentinel-core/src/core/hotspot/rule.rs
diff --git a/sentinel/src/core/hotspot/rule_manager.rs b/sentinel-core/src/core/hotspot/rule_manager.rs
similarity index 100%
rename from sentinel/src/core/hotspot/rule_manager.rs
rename to sentinel-core/src/core/hotspot/rule_manager.rs
diff --git a/sentinel/src/core/hotspot/slot.rs b/sentinel-core/src/core/hotspot/slot.rs
similarity index 100%
rename from sentinel/src/core/hotspot/slot.rs
rename to sentinel-core/src/core/hotspot/slot.rs
diff --git a/sentinel/src/core/hotspot/traffic_shaping/mod.rs b/sentinel-core/src/core/hotspot/traffic_shaping/mod.rs
similarity index 100%
rename from sentinel/src/core/hotspot/traffic_shaping/mod.rs
rename to sentinel-core/src/core/hotspot/traffic_shaping/mod.rs
diff --git a/sentinel/src/core/hotspot/traffic_shaping/reject.rs b/sentinel-core/src/core/hotspot/traffic_shaping/reject.rs
similarity index 100%
rename from sentinel/src/core/hotspot/traffic_shaping/reject.rs
rename to sentinel-core/src/core/hotspot/traffic_shaping/reject.rs
diff --git a/sentinel/src/core/hotspot/traffic_shaping/throttling.rs b/sentinel-core/src/core/hotspot/traffic_shaping/throttling.rs
similarity index 100%
rename from sentinel/src/core/hotspot/traffic_shaping/throttling.rs
rename to sentinel-core/src/core/hotspot/traffic_shaping/throttling.rs
diff --git a/sentinel/src/core/isolation/mod.rs b/sentinel-core/src/core/isolation/mod.rs
similarity index 100%
rename from sentinel/src/core/isolation/mod.rs
rename to sentinel-core/src/core/isolation/mod.rs
diff --git a/sentinel/src/core/isolation/rule.rs b/sentinel-core/src/core/isolation/rule.rs
similarity index 100%
rename from sentinel/src/core/isolation/rule.rs
rename to sentinel-core/src/core/isolation/rule.rs
diff --git a/sentinel/src/core/isolation/rule_manager.rs b/sentinel-core/src/core/isolation/rule_manager.rs
similarity index 100%
rename from sentinel/src/core/isolation/rule_manager.rs
rename to sentinel-core/src/core/isolation/rule_manager.rs
diff --git a/sentinel/src/core/isolation/slot.rs b/sentinel-core/src/core/isolation/slot.rs
similarity index 100%
rename from sentinel/src/core/isolation/slot.rs
rename to sentinel-core/src/core/isolation/slot.rs
diff --git a/sentinel/src/core/log/metric/aggregator.rs b/sentinel-core/src/core/log/metric/aggregator.rs
similarity index 100%
rename from sentinel/src/core/log/metric/aggregator.rs
rename to sentinel-core/src/core/log/metric/aggregator.rs
diff --git a/sentinel/src/core/log/metric/mod.rs b/sentinel-core/src/core/log/metric/mod.rs
similarity index 100%
rename from sentinel/src/core/log/metric/mod.rs
rename to sentinel-core/src/core/log/metric/mod.rs
diff --git a/sentinel/src/core/log/metric/reader.rs b/sentinel-core/src/core/log/metric/reader.rs
similarity index 100%
rename from sentinel/src/core/log/metric/reader.rs
rename to sentinel-core/src/core/log/metric/reader.rs
diff --git a/sentinel/src/core/log/metric/searcher.rs b/sentinel-core/src/core/log/metric/searcher.rs
similarity index 100%
rename from sentinel/src/core/log/metric/searcher.rs
rename to sentinel-core/src/core/log/metric/searcher.rs
diff --git a/sentinel/src/core/log/metric/writer.rs b/sentinel-core/src/core/log/metric/writer.rs
similarity index 100%
rename from sentinel/src/core/log/metric/writer.rs
rename to sentinel-core/src/core/log/metric/writer.rs
diff --git a/sentinel/src/core/log/mod.rs b/sentinel-core/src/core/log/mod.rs
similarity index 100%
rename from sentinel/src/core/log/mod.rs
rename to sentinel-core/src/core/log/mod.rs
diff --git a/sentinel/src/core/log/slot.rs b/sentinel-core/src/core/log/slot.rs
similarity index 100%
rename from sentinel/src/core/log/slot.rs
rename to sentinel-core/src/core/log/slot.rs
diff --git a/sentinel/src/core/mod.rs b/sentinel-core/src/core/mod.rs
similarity index 100%
rename from sentinel/src/core/mod.rs
rename to sentinel-core/src/core/mod.rs
diff --git a/sentinel/src/core/stat/base/bucket_leap_array.rs b/sentinel-core/src/core/stat/base/bucket_leap_array.rs
similarity index 100%
rename from sentinel/src/core/stat/base/bucket_leap_array.rs
rename to sentinel-core/src/core/stat/base/bucket_leap_array.rs
diff --git a/sentinel/src/core/stat/base/leap_array.rs b/sentinel-core/src/core/stat/base/leap_array.rs
similarity index 100%
rename from sentinel/src/core/stat/base/leap_array.rs
rename to sentinel-core/src/core/stat/base/leap_array.rs
diff --git a/sentinel/src/core/stat/base/metric_bucket.rs b/sentinel-core/src/core/stat/base/metric_bucket.rs
similarity index 100%
rename from sentinel/src/core/stat/base/metric_bucket.rs
rename to sentinel-core/src/core/stat/base/metric_bucket.rs
diff --git a/sentinel/src/core/stat/base/mod.rs b/sentinel-core/src/core/stat/base/mod.rs
similarity index 100%
rename from sentinel/src/core/stat/base/mod.rs
rename to sentinel-core/src/core/stat/base/mod.rs
diff --git a/sentinel/src/core/stat/base/sliding_window_metric.rs b/sentinel-core/src/core/stat/base/sliding_window_metric.rs
similarity index 100%
rename from sentinel/src/core/stat/base/sliding_window_metric.rs
rename to sentinel-core/src/core/stat/base/sliding_window_metric.rs
diff --git a/sentinel/src/core/stat/mod.rs b/sentinel-core/src/core/stat/mod.rs
similarity index 100%
rename from sentinel/src/core/stat/mod.rs
rename to sentinel-core/src/core/stat/mod.rs
diff --git a/sentinel/src/core/stat/node_storage.rs b/sentinel-core/src/core/stat/node_storage.rs
similarity index 100%
rename from sentinel/src/core/stat/node_storage.rs
rename to sentinel-core/src/core/stat/node_storage.rs
diff --git a/sentinel/src/core/stat/resource_node.rs b/sentinel-core/src/core/stat/resource_node.rs
similarity index 100%
rename from sentinel/src/core/stat/resource_node.rs
rename to sentinel-core/src/core/stat/resource_node.rs
diff --git a/sentinel/src/core/stat/stat_prepare_slot.rs b/sentinel-core/src/core/stat/stat_prepare_slot.rs
similarity index 100%
rename from sentinel/src/core/stat/stat_prepare_slot.rs
rename to sentinel-core/src/core/stat/stat_prepare_slot.rs
diff --git a/sentinel/src/core/stat/stat_slot.rs b/sentinel-core/src/core/stat/stat_slot.rs
similarity index 100%
rename from sentinel/src/core/stat/stat_slot.rs
rename to sentinel-core/src/core/stat/stat_slot.rs
diff --git a/sentinel/src/core/system/mod.rs b/sentinel-core/src/core/system/mod.rs
similarity index 100%
rename from sentinel/src/core/system/mod.rs
rename to sentinel-core/src/core/system/mod.rs
diff --git a/sentinel/src/core/system/rule.rs b/sentinel-core/src/core/system/rule.rs
similarity index 100%
rename from sentinel/src/core/system/rule.rs
rename to sentinel-core/src/core/system/rule.rs
diff --git a/sentinel/src/core/system/rule_manager.rs b/sentinel-core/src/core/system/rule_manager.rs
similarity index 100%
rename from sentinel/src/core/system/rule_manager.rs
rename to sentinel-core/src/core/system/rule_manager.rs
diff --git a/sentinel/src/core/system/slot.rs b/sentinel-core/src/core/system/slot.rs
similarity index 100%
rename from sentinel/src/core/system/slot.rs
rename to sentinel-core/src/core/system/slot.rs
diff --git a/sentinel/src/core/system_metric.rs b/sentinel-core/src/core/system_metric.rs
similarity index 100%
rename from sentinel/src/core/system_metric.rs
rename to sentinel-core/src/core/system_metric.rs
diff --git a/sentinel/src/datasource/datasource/ds_consul.rs b/sentinel-core/src/datasource/datasource/ds_consul.rs
similarity index 100%
rename from sentinel/src/datasource/datasource/ds_consul.rs
rename to sentinel-core/src/datasource/datasource/ds_consul.rs
diff --git a/sentinel/src/datasource/datasource/ds_etcdv3.rs b/sentinel-core/src/datasource/datasource/ds_etcdv3.rs
similarity index 100%
rename from sentinel/src/datasource/datasource/ds_etcdv3.rs
rename to sentinel-core/src/datasource/datasource/ds_etcdv3.rs
diff --git a/sentinel/src/datasource/datasource/ds_k8s.rs b/sentinel-core/src/datasource/datasource/ds_k8s.rs
similarity index 100%
rename from sentinel/src/datasource/datasource/ds_k8s.rs
rename to sentinel-core/src/datasource/datasource/ds_k8s.rs
diff --git a/sentinel/src/datasource/datasource/mod.rs b/sentinel-core/src/datasource/datasource/mod.rs
similarity index 100%
rename from sentinel/src/datasource/datasource/mod.rs
rename to sentinel-core/src/datasource/datasource/mod.rs
diff --git a/sentinel/src/datasource/helpers.rs b/sentinel-core/src/datasource/helpers.rs
similarity index 100%
rename from sentinel/src/datasource/helpers.rs
rename to sentinel-core/src/datasource/helpers.rs
diff --git a/sentinel/src/datasource/mod.rs b/sentinel-core/src/datasource/mod.rs
similarity index 100%
rename from sentinel/src/datasource/mod.rs
rename to sentinel-core/src/datasource/mod.rs
diff --git a/sentinel/src/datasource/property.rs b/sentinel-core/src/datasource/property.rs
similarity index 100%
rename from sentinel/src/datasource/property.rs
rename to sentinel-core/src/datasource/property.rs
diff --git a/sentinel/src/exporter.rs b/sentinel-core/src/exporter.rs
similarity index 100%
rename from sentinel/src/exporter.rs
rename to sentinel-core/src/exporter.rs
diff --git a/sentinel/src/lib.rs b/sentinel-core/src/lib.rs
similarity index 100%
rename from sentinel/src/lib.rs
rename to sentinel-core/src/lib.rs
diff --git a/sentinel/src/logging.rs b/sentinel-core/src/logging.rs
similarity index 100%
rename from sentinel/src/logging.rs
rename to sentinel-core/src/logging.rs
diff --git a/sentinel/src/macros/cfg.rs b/sentinel-core/src/macros/cfg.rs
similarity index 100%
rename from sentinel/src/macros/cfg.rs
rename to sentinel-core/src/macros/cfg.rs
diff --git a/sentinel/src/macros/flow.rs b/sentinel-core/src/macros/flow.rs
similarity index 100%
rename from sentinel/src/macros/flow.rs
rename to sentinel-core/src/macros/flow.rs
diff --git a/sentinel/src/macros/mod.rs b/sentinel-core/src/macros/mod.rs
similarity index 100%
rename from sentinel/src/macros/mod.rs
rename to sentinel-core/src/macros/mod.rs
diff --git a/sentinel/src/proxy/envoy.rs b/sentinel-core/src/proxy/envoy.rs
similarity index 100%
rename from sentinel/src/proxy/envoy.rs
rename to sentinel-core/src/proxy/envoy.rs
diff --git a/sentinel/src/utils/mod.rs b/sentinel-core/src/utils/mod.rs
similarity index 100%
rename from sentinel/src/utils/mod.rs
rename to sentinel-core/src/utils/mod.rs
diff --git a/sentinel/src/utils/time.rs b/sentinel-core/src/utils/time.rs
similarity index 100%
rename from sentinel/src/utils/time.rs
rename to sentinel-core/src/utils/time.rs
diff --git a/sentinel/tests/mod.rs b/sentinel-core/tests/mod.rs
similarity index 100%
rename from sentinel/tests/mod.rs
rename to sentinel-core/tests/mod.rs
diff --git a/sentinel-macros/Cargo.toml b/sentinel-macros/Cargo.toml
index c24aba9..1c1b4f1 100644
--- a/sentinel-macros/Cargo.toml
+++ b/sentinel-macros/Cargo.toml
@@ -5,7 +5,7 @@ authors = ["Forsworns <378974295@qq.com>"]
edition = "2018"
license = "Apache-2.0"
readme = "README.md"
-documentation = "https://docs.rs/sentinel-rs/latest"
+documentation = "https://docs.rs/sentinel-core/latest"
repository = "https://github.com/sentinel-group/sentinel-rust"
homepage = "https://sentinelguard.io/en-us/"
description = """
diff --git a/sentinel-macros/src/flow.rs b/sentinel-macros/src/flow.rs
index 90e116d..d952361 100644
--- a/sentinel-macros/src/flow.rs
+++ b/sentinel-macros/src/flow.rs
@@ -3,8 +3,6 @@ use proc_macro2::TokenStream as TokenStream2;
use quote::quote;
// macro_todo: Maybe impl `darling::FromMeta` for Enum is better?
-// macro_todo: Maybe refactor the `sentinel-rs` crate, elimnate cyclic dependcies,
-// can reduce this redundant definition?
// Refer to crate `rocket_codegen::http_codegen`.
#[derive(Debug, FromMeta)]
pub(crate) struct Params {
diff --git a/sentinel-macros/src/lib.rs b/sentinel-macros/src/lib.rs
index 2308163..4e72b0c 100644
--- a/sentinel-macros/src/lib.rs
+++ b/sentinel-macros/src/lib.rs
@@ -1,5 +1,5 @@
//! This crate supplies out-of-the-box attribute macors to ease sentinel usage.
-//! It depends on the [sentinel-rs] crate.
+//! It depends on the [sentinel-core] crate.
//! Currently, only one sentinel attribute macro is permited to added on a single function.
#![allow(clippy::needless_update)]
diff --git a/sentinel-macros/src/utils.rs b/sentinel-macros/src/utils.rs
index 59625a3..490db05 100644
--- a/sentinel-macros/src/utils.rs
+++ b/sentinel-macros/src/utils.rs
@@ -64,7 +64,7 @@ macro_rules! wrap_sentinel {
// build sentinel entry
let expanded = quote::quote! {
#(#attrs)* #vis #sig {
- use sentinel_rs::{base, $name, EntryBuilder};
+ use sentinel_core::{base, $name, EntryBuilder};
use std::sync::Arc;
// Load sentinel rules
@@ -126,12 +126,12 @@ pub(crate) fn process_func(mut func: ItemFn) -> ItemFn {
let dummy_func = match output {
ReturnType::Default => {
quote! {
- fn dummy() -> sentinel_rs::Result<()> {}
+ fn dummy() -> sentinel_core::Result<()> {}
}
}
ReturnType::Type(_, return_type) => {
quote! {
- fn dummy() -> sentinel_rs::Result<#return_type> {}
+ fn dummy() -> sentinel_core::Result<#return_type> {}
}
}
};