Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport PR #2586 to release/v1.7 for modify rust package structure #2590

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
487 changes: 445 additions & 42 deletions rust/Cargo.lock

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,11 @@
# limitations under the License.
#
[workspace]
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",
]
8 changes: 4 additions & 4 deletions rust/bin/agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
7 changes: 3 additions & 4 deletions rust/libs/ngt/Cargo.toml → rust/libs/algorithm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
# limitations under the License.
#
[package]
name = "ngt"
name = "algorithm"
kmrmt marked this conversation as resolved.
Show resolved Hide resolved
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" }
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
21 changes: 21 additions & 0 deletions rust/libs/algorithms/faiss/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
# 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]
29 changes: 29 additions & 0 deletions rust/libs/algorithms/faiss/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
//
// 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);
}
}
kmrmt marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -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"
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
// limitations under the License.
//
#include <vector>
#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() {}

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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<Property>;
Expand Down
33 changes: 33 additions & 0 deletions rust/libs/observability/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
# 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"}
6 changes: 3 additions & 3 deletions rust/libs/proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Loading