diff --git a/src/meta-srv/src/keys.rs b/src/meta-srv/src/keys.rs index cbebe55c75..26a7298617 100644 --- a/src/meta-srv/src/keys.rs +++ b/src/meta-srv/src/keys.rs @@ -178,6 +178,15 @@ pub(crate) fn to_removed_key(key: &str) -> String { format!("{REMOVED_PREFIX}-{key}") } +pub fn build_table_route_prefix(catalog: impl AsRef, schema: impl AsRef) -> String { + format!( + "{}-{}-{}-", + TABLE_ROUTE_PREFIX, + catalog.as_ref(), + schema.as_ref() + ) +} + #[derive(Eq, PartialEq, Debug, Clone, Hash, Copy)] pub struct StatKey { pub cluster_id: u64, @@ -279,6 +288,14 @@ impl TryFrom> for StatValue { mod tests { use super::*; + #[test] + fn test_build_prefix() { + assert_eq!( + "__meta_table_route-CATALOG-SCHEMA-", + build_table_route_prefix("CATALOG", "SCHEMA") + ) + } + #[test] fn test_stat_key_round_trip() { let key = StatKey {