-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f4a3af4
commit e0370c1
Showing
50 changed files
with
2,438 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
experimental/mrpc/phoenix-api/policy/fault-server/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
[package] | ||
name = "phoenix-api-policy-fault-server" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
phoenix-api.workspace = true | ||
|
||
serde.workspace = true | ||
itertools.workspace = true | ||
rand.workspace = true |
11 changes: 11 additions & 0 deletions
11
experimental/mrpc/phoenix-api/policy/fault-server/logging/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[package] | ||
name = "phoenix-api-policy-logging" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
phoenix-api.workspace = true | ||
|
||
serde.workspace = true |
14 changes: 14 additions & 0 deletions
14
experimental/mrpc/phoenix-api/policy/fault-server/logging/src/control_plane.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
type IResult<T> = Result<T, phoenix_api::Error>; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub enum Request { | ||
NewConfig(), | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub enum ResponseKind {} | ||
|
||
#[derive(Debug, Serialize, Deserialize)] | ||
pub struct Response(pub IResult<ResponseKind>); |
1 change: 1 addition & 0 deletions
1
experimental/mrpc/phoenix-api/policy/fault-server/logging/src/lib.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod control_plane; |
14 changes: 14 additions & 0 deletions
14
experimental/mrpc/phoenix-api/policy/fault-server/src/control_plane.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
type IResult<T> = Result<T, phoenix_api::Error>; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub enum Request { | ||
NewConfig(), | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub enum ResponseKind {} | ||
|
||
#[derive(Debug, Serialize, Deserialize)] | ||
pub struct Response(pub IResult<ResponseKind>); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod control_plane; |
11 changes: 11 additions & 0 deletions
11
experimental/mrpc/phoenix-api/policy/logging-server/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[package] | ||
name = "phoenix-api-policy-logging-server" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
phoenix-api.workspace = true | ||
|
||
serde.workspace = true |
14 changes: 14 additions & 0 deletions
14
experimental/mrpc/phoenix-api/policy/logging-server/src/control_plane.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
type IResult<T> = Result<T, phoenix_api::Error>; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub enum Request { | ||
NewConfig(), | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub enum ResponseKind {} | ||
|
||
#[derive(Debug, Serialize, Deserialize)] | ||
pub struct Response(pub IResult<ResponseKind>); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod control_plane; |
11 changes: 11 additions & 0 deletions
11
experimental/mrpc/phoenix-api/policy/metrics-server/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[package] | ||
name = "phoenix-api-policy-metrics-server" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
phoenix-api.workspace = true | ||
|
||
serde.workspace = true |
14 changes: 14 additions & 0 deletions
14
experimental/mrpc/phoenix-api/policy/metrics-server/src/control_plane.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
type IResult<T> = Result<T, phoenix_api::Error>; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub enum Request { | ||
NewConfig(), | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub enum ResponseKind {} | ||
|
||
#[derive(Debug, Serialize, Deserialize)] | ||
pub struct Response(pub IResult<ResponseKind>); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod control_plane; |
11 changes: 11 additions & 0 deletions
11
experimental/mrpc/phoenix-api/policy/mutation-server/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[package] | ||
name = "phoenix-api-policy-mutation-server" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
phoenix-api.workspace = true | ||
|
||
serde.workspace = true |
14 changes: 14 additions & 0 deletions
14
experimental/mrpc/phoenix-api/policy/mutation-server/src/control_plane.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
type IResult<T> = Result<T, phoenix_api::Error>; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub enum Request { | ||
NewConfig(), | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub enum ResponseKind {} | ||
|
||
#[derive(Debug, Serialize, Deserialize)] | ||
pub struct Response(pub IResult<ResponseKind>); |
1 change: 1 addition & 0 deletions
1
experimental/mrpc/phoenix-api/policy/mutation-server/src/lib.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod control_plane; |
11 changes: 11 additions & 0 deletions
11
experimental/mrpc/phoenix-api/policy/ratelimit-drop-server/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[package] | ||
name = "phoenix-api-policy-ratelimit-drop-server" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
phoenix-api.workspace = true | ||
|
||
serde.workspace = true |
14 changes: 14 additions & 0 deletions
14
experimental/mrpc/phoenix-api/policy/ratelimit-drop-server/src/control_plane.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
type IResult<T> = Result<T, String>; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub enum Request { | ||
NewConfig(u64, u64), | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub enum ResponseKind {} | ||
|
||
#[derive(Debug, Serialize, Deserialize)] | ||
pub struct Response(pub IResult<ResponseKind>); |
1 change: 1 addition & 0 deletions
1
experimental/mrpc/phoenix-api/policy/ratelimit-drop-server/src/lib.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod control_plane; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
[package] | ||
name = "phoenix-FaultServer-server" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
phoenix_common.workspace = true | ||
phoenix-api-policy-FaultServer.workspace = true | ||
mrpc-marshal.workspace = true | ||
mrpc-derive.workspace = true | ||
shm.workspace = true | ||
phoenix-api = { workspace = true, features = ["mrpc"] } | ||
|
||
futures.workspace = true | ||
minstant.workspace = true | ||
thiserror.workspace = true | ||
serde = { workspace = true, features = ["derive"] } | ||
serde_json.workspace = true | ||
anyhow.workspace = true | ||
nix.workspace = true | ||
toml = { workspace = true, features = ["preserve_order"] } | ||
bincode.workspace = true | ||
chrono.workspace = true | ||
itertools.workspace = true | ||
rand.workspace = true |
37 changes: 37 additions & 0 deletions
37
experimental/mrpc/plugin/policy/fault-server/src/config.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use chrono::{Datelike, Timelike, Utc}; | ||
use phoenix_common::log; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use chrono::prelude::*; | ||
use itertools::iproduct; | ||
use rand::Rng; | ||
|
||
#[derive(Debug, Clone, Copy, DeFaultServer, Serialize, Deserialize)] | ||
#[serde(deny_unknown_fields)] | ||
pub struct FaultServerConfig {} | ||
|
||
impl FaultServerConfig { | ||
/// Get config from toml file | ||
pub fn new(config: Option<&str>) -> anyhow::Result<Self> { | ||
let config = toml::from_str(config.unwrap_or(""))?; | ||
Ok(config) | ||
} | ||
} | ||
|
||
pub fn create_log_file() -> std::fs::File { | ||
std::fs::create_dir_all("/tmp/phoenix/log").expect("mkdir failed"); | ||
let now = Utc::now(); | ||
let date_string = format!( | ||
"{}-{}-{}-{}-{}-{}", | ||
now.year(), | ||
now.month(), | ||
now.day(), | ||
now.hour(), | ||
now.minute(), | ||
now.second() | ||
); | ||
let file_name = format!("/tmp/phoenix/log/logging_engine_{}.log", date_string); | ||
///log::info!("create log file {}", file_name); | ||
let log_file = std::fs::File::create(file_name).expect("create file failed"); | ||
log_file | ||
} |
Oops, something went wrong.