mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2025-12-23 06:30:05 +00:00
chore: add build_table_route_prefix (#1269)
This commit is contained in:
@@ -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<str>, schema: impl AsRef<str>) -> 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<Vec<u8>> 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 {
|
||||
|
||||
Reference in New Issue
Block a user