Skip to content

Commit

Permalink
refactor: ✂ Rename packages
Browse files Browse the repository at this point in the history
for releasing
  • Loading branch information
Forsworns committed Feb 28, 2022
1 parent ffcf7ad commit e466c47
Show file tree
Hide file tree
Showing 137 changed files with 189 additions and 162 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/grcov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/platforms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
target
data
log
logs
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
42 changes: 21 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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",
]
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<img src="https://user-images.githubusercontent.com/9434884/43697219-3cb4ef3a-9975-11e8-9a9c-73f4f537442d.png" alt="Sentinel Logo" width="50%">

# 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]
Expand All @@ -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
Expand Down Expand Up @@ -41,15 +41,15 @@ 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

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
Expand Down
10 changes: 5 additions & 5 deletions examples/config/from_entity/from_entity.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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);
}
8 changes: 4 additions & 4 deletions examples/config/from_yaml/from_yaml.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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);
}
8 changes: 4 additions & 4 deletions examples/datasources/consul.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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);
Expand All @@ -52,7 +52,7 @@ fn main() -> Result<()> {

fn basic_flow_example() -> Vec<JoinHandle<()>> {
// 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 {
Expand Down Expand Up @@ -86,6 +86,6 @@ fn basic_flow_example() -> Vec<JoinHandle<()>> {
// 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);
}
8 changes: 4 additions & 4 deletions examples/datasources/etcdv3.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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);
Expand All @@ -55,7 +55,7 @@ async fn main() -> Result<()> {

async fn basic_flow_example() -> Vec<JoinHandle<()>> {
// 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 {
Expand Down Expand Up @@ -89,6 +89,6 @@ async fn basic_flow_example() -> Vec<JoinHandle<()>> {
// 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;
}
8 changes: 4 additions & 4 deletions examples/datasources/k8s.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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);
Expand All @@ -64,7 +64,7 @@ async fn main() -> Result<()> {

async fn basic_flow_example() -> Vec<JoinHandle<()>> {
// 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 {
Expand Down Expand Up @@ -98,7 +98,7 @@ async fn basic_flow_example() -> Vec<JoinHandle<()>> {
// 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;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/ebpf/userspace/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
8 changes: 4 additions & 4 deletions examples/ebpf/userspace/src/port.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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,
Expand Down Expand Up @@ -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()
Expand All @@ -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()
);
}
}
Expand Down
Loading

0 comments on commit e466c47

Please sign in to comment.