Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat(strategy): change type of default_target #108

Merged
merged 2 commits into from
Jun 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions pisa-proxy/proxy/strategy/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
pub struct ReadWriteSplitting {
#[serde(rename = "static")]
model: ReadWriteSplittingStatic,
pub undynamic: ReadWriteSplittingStatic,
}

#[derive(Debug, Serialize, Deserialize, Clone, Default)]
pub struct ReadWriteSplittingStatic {
pub default_target: String,
pub default_target: TargetRole,
#[serde(rename = "rule")]
pub rules: Vec<ReadWriteSplittingRule>,
}
Expand All @@ -43,9 +43,15 @@ pub struct RegexRule {
pub algorithm_name: String,
}

#[derive(Debug, Serialize, Deserialize, Clone)]
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "lowercase")]
pub enum TargetRole {
Read,
ReadWrite,
}

impl Default for TargetRole {
fn default() -> Self {
TargetRole::ReadWrite
}
}