diff --git a/Cargo.lock b/Cargo.lock index 98c71ab057..f92b955d32 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2155,6 +2155,7 @@ version = "2.2.0-alpha" dependencies = [ "anyhow", "common", + "seahash", "storage", "temp-dir", "test-log", @@ -2617,7 +2618,7 @@ checksum = "0c1318b19085f08681016926435853bbf7858f9c082d0999b80550ff5d9abe15" dependencies = [ "bytes", "heck", - "itertools 0.10.5", + "itertools 0.13.0", "log", "multimap", "once_cell", @@ -2637,7 +2638,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9552f850d5f0964a4e4d0bf306459ac29323ddfbae05e35a7c0d35cb0803cc5" dependencies = [ "anyhow", - "itertools 0.10.5", + "itertools 0.13.0", "proc-macro2", "quote", "syn", @@ -2825,6 +2826,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "seahash" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" + [[package]] name = "semver" version = "1.0.23" diff --git a/Cargo.toml b/Cargo.toml index d5d24cf802..84ae73c6e3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,6 +37,7 @@ members = [ [workspace.dependencies] anyhow = { version = "1.0" } +seahash = { version = "4" } metric_engine = { path = "src/metric_engine" } horaedb_storage = { package = "storage", path = "src/storage" } common = { path = "src/common" } diff --git a/src/metric_engine/Cargo.toml b/src/metric_engine/Cargo.toml index ae3acf25da..ceaf134241 100644 --- a/src/metric_engine/Cargo.toml +++ b/src/metric_engine/Cargo.toml @@ -29,6 +29,7 @@ description.workspace = true anyhow = { workspace = true } common = { workspace = true } horaedb_storage = { workspace = true } +seahash = { workspace = true } thiserror = { workspace = true } tokio = { workspace = true } tracing = { workspace = true } diff --git a/src/metric_engine/src/metric/mod.rs b/src/metric_engine/src/metric/mod.rs index d51640973e..bdd1d6623c 100644 --- a/src/metric_engine/src/metric/mod.rs +++ b/src/metric_engine/src/metric/mod.rs @@ -42,3 +42,9 @@ impl MetricManager { struct Inner { storage: TimeMergeStorageRef, } + +impl Inner { + async fn populate_metric_ids(&self, _samples: &mut [Sample]) -> Result<()> { + todo!() + } +} diff --git a/src/metric_engine/src/types.rs b/src/metric_engine/src/types.rs index d371de23a1..6203bc174d 100644 --- a/src/metric_engine/src/types.rs +++ b/src/metric_engine/src/types.rs @@ -35,3 +35,7 @@ pub struct Sample { /// hash of labels(sorted) pub series_id: Option, } + +pub fn hash(buf: &[u8]) -> u64 { + seahash::hash(buf) +}