Skip to content

Commit

Permalink
feat(strategy): change type of default_target (database-mesh#108)
Browse files Browse the repository at this point in the history
* Signed-off-by: xuanyuan300 <[email protected]>
feat(strategy): changed type of `default_target`

* Signed-off-by: xuanyuan300 <[email protected]>
feat(strategy): add Default
  • Loading branch information
xuanyuan300 authored and mlycore committed Jun 27, 2022
1 parent 6a8aed8 commit 01956b1
Showing 1 changed file with 9 additions and 3 deletions.
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
}
}

0 comments on commit 01956b1

Please sign in to comment.