Unverified Commit eb821bee authored by Faradawn Yang's avatar Faradawn Yang Committed by GitHub
Browse files

chore: Remove unused RouterType and ModelMetaData (#1138)

Remove RouterType and ModelMetaData in `lib/runtime/src/protocols.rs`, which are unused (no outside reference). It is because that the routing has been moved to its own module, `pipeline/network/egress/push_router.rs`. Therefore, the legacy definition of RouterType in `protocols.rs` is no longer used.
parent 80256acf
...@@ -183,59 +183,12 @@ impl Endpoint { ...@@ -183,59 +183,12 @@ impl Endpoint {
} }
} }
#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum RouterType {
PushRoundRobin,
PushRandom,
}
impl Default for RouterType {
fn default() -> Self {
Self::PushRandom
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)]
pub struct ModelMetaData {
pub name: String,
pub component: Component,
pub router_type: RouterType,
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use std::convert::TryFrom; use std::convert::TryFrom;
use std::str::FromStr; use std::str::FromStr;
#[test]
fn test_router_type_default() {
let default_router = RouterType::default();
assert_eq!(default_router, RouterType::PushRandom);
}
#[test]
fn test_router_type_serialization() {
let router_round_robin = RouterType::PushRoundRobin;
let router_random = RouterType::PushRandom;
let serialized_round_robin = serde_json::to_string(&router_round_robin).unwrap();
let serialized_random = serde_json::to_string(&router_random).unwrap();
assert_eq!(serialized_round_robin, "\"push_round_robin\"");
assert_eq!(serialized_random, "\"push_random\"");
}
#[test]
fn test_router_type_deserialization() {
let round_robin: RouterType = serde_json::from_str("\"push_round_robin\"").unwrap();
let random: RouterType = serde_json::from_str("\"push_random\"").unwrap();
assert_eq!(round_robin, RouterType::PushRoundRobin);
assert_eq!(random, RouterType::PushRandom);
}
#[test] #[test]
fn test_valid_endpoint_from() { fn test_valid_endpoint_from() {
let input = "namespace1/component1/endpoint1"; let input = "namespace1/component1/endpoint1";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment