From f2d4fdf72b437137938b7909bdbac9ae743e797c Mon Sep 17 00:00:00 2001 From: Kosuke Morimoto Date: Sat, 31 Aug 2024 08:35:40 +0900 Subject: [PATCH 1/2] modify rust package structure (#2586) * modify rust package structure Signed-off-by: Kosuke Morimoto * format Signed-off-by: Kosuke Morimoto --------- Signed-off-by: Kosuke Morimoto Co-authored-by: Yusuke Kato --- rust/Cargo.lock | 502 ++++++++++++++++-- rust/Cargo.toml | 11 + rust/bin/agent/Cargo.toml | 8 +- rust/libs/{ngt => algorithm}/Cargo.toml | 7 +- rust/libs/{ngt => algorithm}/src/lib.rs | 2 +- rust/libs/algorithms/faiss/Cargo.toml | 21 + rust/libs/algorithms/faiss/src/lib.rs | 29 + .../{ngt-rs => algorithms/ngt}/Cargo.toml | 10 +- rust/libs/{ngt-rs => algorithms/ngt}/build.rs | 0 .../{ngt-rs => algorithms/ngt}/src/input.cpp | 4 +- .../{ngt-rs => algorithms/ngt}/src/input.h | 0 .../{ngt-rs => algorithms/ngt}/src/lib.rs | 2 +- rust/libs/observability/Cargo.toml | 33 ++ rust/libs/proto/Cargo.toml | 6 +- 14 files changed, 574 insertions(+), 61 deletions(-) rename rust/libs/{ngt => algorithm}/Cargo.toml (80%) rename rust/libs/{ngt => algorithm}/src/lib.rs (94%) create mode 100644 rust/libs/algorithms/faiss/Cargo.toml create mode 100644 rust/libs/algorithms/faiss/src/lib.rs rename rust/libs/{ngt-rs => algorithms/ngt}/Cargo.toml (81%) rename rust/libs/{ngt-rs => algorithms/ngt}/build.rs (100%) rename rust/libs/{ngt-rs => algorithms/ngt}/src/input.cpp (98%) rename rust/libs/{ngt-rs => algorithms/ngt}/src/input.h (100%) rename rust/libs/{ngt-rs => algorithms/ngt}/src/lib.rs (99%) create mode 100644 rust/libs/observability/Cargo.toml diff --git a/rust/Cargo.lock b/rust/Cargo.lock index c9e69d71a6..9806d072e8 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -21,12 +21,20 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" name = "agent" version = "0.1.0" dependencies = [ - "ngt", - "prost", + "algorithm", + "prost 0.13.1", "proto", "tokio", "tokio-stream", - "tonic", + "tonic 0.12.1", +] + +[[package]] +name = "algorithm" +version = "0.1.0" +dependencies = [ + "faiss", + "ngt", ] [[package]] @@ -68,6 +76,12 @@ dependencies = [ "syn", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "autocfg" version = "1.3.0" @@ -81,13 +95,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" dependencies = [ "async-trait", - "axum-core", + "axum-core 0.3.4", "bitflags 1.3.2", "bytes", "futures-util", - "http", - "http-body", - "hyper", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.30", "itoa", "matchit", "memchr", @@ -96,7 +110,34 @@ dependencies = [ "pin-project-lite", "rustversion", "serde", - "sync_wrapper", + "sync_wrapper 0.1.2", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" +dependencies = [ + "async-trait", + "axum-core 0.4.3", + "bytes", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "sync_wrapper 1.0.1", "tower", "tower-layer", "tower-service", @@ -111,10 +152,30 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http", - "http-body", + "http 0.2.12", + "http-body 0.4.6", + "mime", + "rustversion", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-core" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", "mime", + "pin-project-lite", "rustversion", + "sync_wrapper 0.1.2", "tower-layer", "tower-service", ] @@ -149,6 +210,12 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + [[package]] name = "bitflags" version = "1.3.2" @@ -261,6 +328,10 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "faiss" +version = "0.1.0" + [[package]] name = "fnv" version = "1.0.7" @@ -334,8 +405,32 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", +<<<<<<< HEAD "http", "indexmap 2.3.0", +======= + "http 0.2.12", + "indexmap 2.4.0", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "h2" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http 1.1.0", + "indexmap 2.4.0", +>>>>>>> b17cc73a0 (modify rust package structure (#2586)) "slab", "tokio", "tokio-util", @@ -371,6 +466,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http-body" version = "0.4.6" @@ -378,7 +484,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http", + "http 0.2.12", + "pin-project-lite", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http 1.1.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", "pin-project-lite", ] @@ -404,9 +533,9 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2", - "http", - "http-body", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", "httparse", "httpdate", "itoa", @@ -418,19 +547,86 @@ dependencies = [ "want", ] +[[package]] +name = "hyper" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2 0.4.6", + "http 1.1.0", + "http-body 1.0.1", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + [[package]] name = "hyper-timeout" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ - "hyper", + "hyper 0.14.30", "pin-project-lite", "tokio", "tokio-io-timeout", ] [[package]] +<<<<<<< HEAD +======= +name = "hyper-timeout" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3203a961e5c83b6f5498933e78b6b263e208c197b63e9c6c53cc82ffd3f63793" +dependencies = [ + "hyper 1.4.1", + "hyper-util", + "pin-project-lite", + "tokio", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", + "hyper 1.4.1", + "pin-project-lite", + "socket2", + "tokio", + "tower", + "tower-service", + "tracing", +] + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +>>>>>>> b17cc73a0 (modify rust package structure (#2586)) name = "indexmap" version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -465,6 +661,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.11" @@ -575,13 +780,6 @@ dependencies = [ [[package]] name = "ngt" version = "0.1.0" -dependencies = [ - "ngt-rs", -] - -[[package]] -name = "ngt-rs" -version = "0.1.0" dependencies = [ "anyhow", "cxx", @@ -606,6 +804,106 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] +<<<<<<< HEAD +======= +name = "opentelemetry" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b69a91d4893e713e06f724597ad630f1fa76057a5e1026c0ca67054a9032a76" +dependencies = [ + "futures-core", + "futures-sink", + "js-sys", + "once_cell", + "pin-project-lite", + "thiserror", +] + +[[package]] +name = "opentelemetry-http" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0ba633e55c5ea6f431875ba55e71664f2fa5d3a90bd34ec9302eecc41c865dd" +dependencies = [ + "async-trait", + "bytes", + "http 0.2.12", + "opentelemetry", + "reqwest", +] + +[[package]] +name = "opentelemetry-otlp" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a94c69209c05319cdf7460c6d4c055ed102be242a0a6245835d7bc42c6ec7f54" +dependencies = [ + "async-trait", + "futures-core", + "http 0.2.12", + "opentelemetry", + "opentelemetry-http", + "opentelemetry-proto", + "opentelemetry_sdk", + "prost 0.12.6", + "reqwest", + "thiserror", + "tokio", + "tonic 0.11.0", +] + +[[package]] +name = "opentelemetry-proto" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "984806e6cf27f2b49282e2a05e288f30594f3dbc74eb7a6e99422bc48ed78162" +dependencies = [ + "opentelemetry", + "opentelemetry_sdk", + "prost 0.12.6", + "tonic 0.11.0", +] + +[[package]] +name = "opentelemetry-semantic-conventions" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cefe0543875379e47eb5f1e68ff83f45cc41366a92dfd0d073d513bf68e9a05" + +[[package]] +name = "opentelemetry_sdk" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae312d58eaa90a82d2e627fd86e075cf5230b3f11794e2ed74199ebbe572d4fd" +dependencies = [ + "async-trait", + "futures-channel", + "futures-executor", + "futures-util", + "glob", + "lazy_static", + "once_cell", + "opentelemetry", + "ordered-float", + "percent-encoding", + "rand", + "serde_json", + "thiserror", + "tokio", + "tokio-stream", +] + +[[package]] +name = "ordered-float" +version = "4.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a91171844676f8c7990ce64959210cd2eaef32c2612c50f9fae9f8aaa6065a6" +dependencies = [ + "num-traits", +] + +[[package]] +>>>>>>> b17cc73a0 (modify rust package structure (#2586)) name = "owo-colors" version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -697,7 +995,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" dependencies = [ "bytes", - "prost-derive", + "prost-derive 0.12.6", +] + +[[package]] +name = "prost" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13db3d3fde688c61e2446b4d843bc27a7e8af269a69440c0308021dc92333cc" +dependencies = [ + "bytes", + "prost-derive 0.13.1", ] [[package]] @@ -707,7 +1015,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" dependencies = [ "anyhow", - "itertools", + "itertools 0.12.1", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "prost-derive" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18bec9b0adc4eba778b33684b7ba3e7137789434769ee3ce3930463ef904cfca" +dependencies = [ + "anyhow", + "itertools 0.13.0", "proc-macro2", "quote", "syn", @@ -715,11 +1036,11 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.12.6" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9091c90b0a32608e984ff2fa4091273cbdd755d54935c51d520887f4a1dbd5b0" +checksum = "cee5168b05f49d4b0ca581206eb14a7b22fafd963efe729ac48eb03266e25cc2" dependencies = [ - "prost", + "prost 0.13.1", ] [[package]] @@ -727,8 +1048,8 @@ name = "proto" version = "0.1.0" dependencies = [ "futures-core", - "prost", - "tonic", + "prost 0.13.1", + "tonic 0.12.1", "tonic-types", ] @@ -781,6 +1102,45 @@ dependencies = [ ] [[package]] +<<<<<<< HEAD +======= +name = "reqwest" +version = "0.11.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" +dependencies = [ + "base64 0.21.7", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.30", + "ipnet", + "js-sys", + "log", + "mime", + "once_cell", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper 0.1.2", + "system-configuration", + "tokio", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", +] + +[[package]] +>>>>>>> b17cc73a0 (modify rust package structure (#2586)) name = "rustc-demangle" version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -916,6 +1276,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] +<<<<<<< HEAD +======= +name = "sync_wrapper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +>>>>>>> b17cc73a0 (modify rust package structure (#2586)) name = "termcolor" version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1037,17 +1427,47 @@ checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13" dependencies = [ "async-stream", "async-trait", - "axum", - "base64", + "axum 0.6.20", + "base64 0.21.7", "bytes", - "h2", - "http", - "http-body", - "hyper", - "hyper-timeout", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.30", + "hyper-timeout 0.4.1", + "percent-encoding", + "pin-project", + "prost 0.12.6", + "tokio", + "tokio-stream", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tonic" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38659f4a91aba8598d27821589f5db7dddd94601e7a01b1e485a50e5484c7401" +dependencies = [ + "async-stream", + "async-trait", + "axum 0.7.5", + "base64 0.22.1", + "bytes", + "h2 0.4.6", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", + "hyper 1.4.1", + "hyper-timeout 0.5.1", + "hyper-util", "percent-encoding", "pin-project", - "prost", + "prost 0.13.1", + "socket2", "tokio", "tokio-stream", "tower", @@ -1058,13 +1478,13 @@ dependencies = [ [[package]] name = "tonic-types" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4aa089471d8d4c60ec3aef047739713a4695f0b309d4cea0073bc55201064f4" +checksum = "5563899ec5aa5f0ec48e37457461ffbbc184c9a0f413f715dacd154f46408a10" dependencies = [ - "prost", + "prost 0.13.1", "prost-types", - "tonic", + "tonic 0.12.1", ] [[package]] diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 666259b2b2..47e9649ced 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -14,4 +14,15 @@ # limitations under the License. # [workspace] +<<<<<<< HEAD members = ["libs/proto", "libs/ngt", "libs/ngt-rs", "bin/agent"] +======= +members = [ + "libs/observability", + "libs/proto", + "bin/agent", + "libs/algorithm", + "libs/algorithms/ngt", + "libs/algorithms/faiss", +] +>>>>>>> b17cc73a0 (modify rust package structure (#2586)) diff --git a/rust/bin/agent/Cargo.toml b/rust/bin/agent/Cargo.toml index fdfce09733..7e11dd94d6 100644 --- a/rust/bin/agent/Cargo.toml +++ b/rust/bin/agent/Cargo.toml @@ -21,9 +21,9 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -ngt = { version = "0.1.0", path = "../../libs/ngt" } -prost = "0.12.4" +algorithm = { version = "0.1.0", path = "../../libs/algorithm" } +prost = "0.13.1" proto = { version = "0.1.0", path = "../../libs/proto" } -tokio = { version = "1.37.0", features = ["full"] } +tokio = { version = "1.39.3", features = ["full"] } tokio-stream = { version = "0.1.15", features = ["full"] } -tonic = "0.11.0" +tonic = "0.12.1" diff --git a/rust/libs/ngt/Cargo.toml b/rust/libs/algorithm/Cargo.toml similarity index 80% rename from rust/libs/ngt/Cargo.toml rename to rust/libs/algorithm/Cargo.toml index 59a5530b8c..c4ca71aef8 100644 --- a/rust/libs/ngt/Cargo.toml +++ b/rust/libs/algorithm/Cargo.toml @@ -14,11 +14,10 @@ # limitations under the License. # [package] -name = "ngt" +name = "algorithm" version = "0.1.0" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] -ngt-rs = { version = "0.1.0", path = "../ngt-rs" } +faiss = { version = "0.1.0", path = "../algorithms/faiss" } +ngt = { version = "0.1.0", path = "../algorithms/ngt" } diff --git a/rust/libs/ngt/src/lib.rs b/rust/libs/algorithm/src/lib.rs similarity index 94% rename from rust/libs/ngt/src/lib.rs rename to rust/libs/algorithm/src/lib.rs index 958ec94a9e..cdca5d93de 100644 --- a/rust/libs/ngt/src/lib.rs +++ b/rust/libs/algorithm/src/lib.rs @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // -pub fn add(left: usize, right: usize) -> usize { +pub fn add(left: u64, right: u64) -> u64 { left + right } diff --git a/rust/libs/algorithms/faiss/Cargo.toml b/rust/libs/algorithms/faiss/Cargo.toml new file mode 100644 index 0000000000..bfe824b11e --- /dev/null +++ b/rust/libs/algorithms/faiss/Cargo.toml @@ -0,0 +1,21 @@ +# +# Copyright (C) 2019-2024 vdaas.org vald team +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# You may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +[package] +name = "faiss" +version = "0.1.0" +edition = "2021" + +[dependencies] diff --git a/rust/libs/algorithms/faiss/src/lib.rs b/rust/libs/algorithms/faiss/src/lib.rs new file mode 100644 index 0000000000..cdca5d93de --- /dev/null +++ b/rust/libs/algorithms/faiss/src/lib.rs @@ -0,0 +1,29 @@ +// +// Copyright (C) 2019-2024 vdaas.org vald team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +pub fn add(left: u64, right: u64) -> u64 { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} diff --git a/rust/libs/ngt-rs/Cargo.toml b/rust/libs/algorithms/ngt/Cargo.toml similarity index 81% rename from rust/libs/ngt-rs/Cargo.toml rename to rust/libs/algorithms/ngt/Cargo.toml index 7caa2b26a0..64517bf474 100644 --- a/rust/libs/ngt-rs/Cargo.toml +++ b/rust/libs/algorithms/ngt/Cargo.toml @@ -14,17 +14,17 @@ # limitations under the License. # [package] -name = "ngt-rs" +name = "ngt" version = "0.1.0" edition = "2021" [dependencies] -anyhow = "1.0.81" -cxx = { version = "1.0.117", features = ["c++20"] } +anyhow = "1.0.86" +cxx = { version = "1.0.126", features = ["c++20"] } [build-dependencies] -cxx-build = "1.0.117" -miette = { version = "7.1.0", features = ["fancy"] } +cxx-build = "1.0.126" +miette = { version = "7.2.0", features = ["fancy"] } [dev-dependencies] rand = "0.8.5" diff --git a/rust/libs/ngt-rs/build.rs b/rust/libs/algorithms/ngt/build.rs similarity index 100% rename from rust/libs/ngt-rs/build.rs rename to rust/libs/algorithms/ngt/build.rs diff --git a/rust/libs/ngt-rs/src/input.cpp b/rust/libs/algorithms/ngt/src/input.cpp similarity index 98% rename from rust/libs/ngt-rs/src/input.cpp rename to rust/libs/algorithms/ngt/src/input.cpp index 7e35fbd91d..c956f6da33 100644 --- a/rust/libs/ngt-rs/src/input.cpp +++ b/rust/libs/algorithms/ngt/src/input.cpp @@ -14,8 +14,8 @@ // limitations under the License. // #include -#include "ngt-rs/src/input.h" -#include "ngt-rs/src/lib.rs.h" +#include "ngt/src/input.h" +#include "ngt/src/lib.rs.h" Property::Property(): p() {} diff --git a/rust/libs/ngt-rs/src/input.h b/rust/libs/algorithms/ngt/src/input.h similarity index 100% rename from rust/libs/ngt-rs/src/input.h rename to rust/libs/algorithms/ngt/src/input.h diff --git a/rust/libs/ngt-rs/src/lib.rs b/rust/libs/algorithms/ngt/src/lib.rs similarity index 99% rename from rust/libs/ngt-rs/src/lib.rs rename to rust/libs/algorithms/ngt/src/lib.rs index 951faff333..8474a3ee0c 100644 --- a/rust/libs/ngt-rs/src/lib.rs +++ b/rust/libs/algorithms/ngt/src/lib.rs @@ -42,7 +42,7 @@ pub mod ffi { } unsafe extern "C++" { - include!("ngt-rs/src/input.h"); + include!("ngt/src/input.h"); type Property; fn new_property() -> UniquePtr; diff --git a/rust/libs/observability/Cargo.toml b/rust/libs/observability/Cargo.toml new file mode 100644 index 0000000000..1ef800cefb --- /dev/null +++ b/rust/libs/observability/Cargo.toml @@ -0,0 +1,33 @@ +# +# Copyright (C) 2019-2024 vdaas.org vald team +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# You may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +[package] +name = "observability" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +opentelemetry = { version = "0.23" } +opentelemetry_sdk = { version = "0.23", features = ["rt-tokio"] } +opentelemetry-otlp = { version = "0.16.0", features = ["http-proto", "reqwest-client", "logs"] } +tokio = { version = "1.39.3", features = ["full"] } +serde_json = { version="1.0.125" } +opentelemetry-semantic-conventions = { version = "0.16.0"} +scopeguard = { version = "1.2.0"} +paste = {version = "1.0.15"} +anyhow = { version = "1.0.86"} +url = { version = "2.5.2"} diff --git a/rust/libs/proto/Cargo.toml b/rust/libs/proto/Cargo.toml index 72ea9d88f0..12a488941d 100644 --- a/rust/libs/proto/Cargo.toml +++ b/rust/libs/proto/Cargo.toml @@ -22,6 +22,6 @@ edition = "2021" [dependencies] futures-core = "0.3.30" -prost = "0.12.3" -tonic = "0.11.0" -tonic-types = "0.11.0" +prost = "0.13.1" +tonic = "0.12.1" +tonic-types = "0.12.1" From 66a17535040dcd78f2625767a7c019873c7dcf39 Mon Sep 17 00:00:00 2001 From: Kosuke Morimoto Date: Wed, 4 Sep 2024 11:56:33 +0900 Subject: [PATCH 2/2] resolve conflict Signed-off-by: Kosuke Morimoto --- rust/Cargo.lock | 17 ----------------- rust/Cargo.toml | 4 ---- 2 files changed, 21 deletions(-) diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 9806d072e8..5860dad657 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -405,10 +405,6 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", -<<<<<<< HEAD - "http", - "indexmap 2.3.0", -======= "http 0.2.12", "indexmap 2.4.0", "slab", @@ -430,7 +426,6 @@ dependencies = [ "futures-sink", "http 1.1.0", "indexmap 2.4.0", ->>>>>>> b17cc73a0 (modify rust package structure (#2586)) "slab", "tokio", "tokio-util", @@ -581,8 +576,6 @@ dependencies = [ ] [[package]] -<<<<<<< HEAD -======= name = "hyper-timeout" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -626,7 +619,6 @@ dependencies = [ ] [[package]] ->>>>>>> b17cc73a0 (modify rust package structure (#2586)) name = "indexmap" version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -804,8 +796,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] -<<<<<<< HEAD -======= name = "opentelemetry" version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -903,7 +893,6 @@ dependencies = [ ] [[package]] ->>>>>>> b17cc73a0 (modify rust package structure (#2586)) name = "owo-colors" version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1102,8 +1091,6 @@ dependencies = [ ] [[package]] -<<<<<<< HEAD -======= name = "reqwest" version = "0.11.27" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1140,7 +1127,6 @@ dependencies = [ ] [[package]] ->>>>>>> b17cc73a0 (modify rust package structure (#2586)) name = "rustc-demangle" version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1276,8 +1262,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] -<<<<<<< HEAD -======= name = "sync_wrapper" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1305,7 +1289,6 @@ dependencies = [ ] [[package]] ->>>>>>> b17cc73a0 (modify rust package structure (#2586)) name = "termcolor" version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 47e9649ced..7ab97dd32b 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -14,9 +14,6 @@ # limitations under the License. # [workspace] -<<<<<<< HEAD -members = ["libs/proto", "libs/ngt", "libs/ngt-rs", "bin/agent"] -======= members = [ "libs/observability", "libs/proto", @@ -25,4 +22,3 @@ members = [ "libs/algorithms/ngt", "libs/algorithms/faiss", ] ->>>>>>> b17cc73a0 (modify rust package structure (#2586))