vesoft-inc / nebula-rust

Nebula Graph Client API in Rust
Apache License 2.0
36 stars 7 forks source link

Why is nebula-client in this repo inconsistent with crates.io? #21

Closed GG2002 closed 2 months ago

GG2002 commented 3 months ago

General Question

I tried to run code in demos/tokio/src/v3_graph_client.rs in my new project, and I wrote Cargo.toml as follows:

[package]
name = "test-nebula-rust"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
# non-pool
fbthrift-transport = { version = "0.9", features = ["impl_tokio"] }
nebula-client = { version = "0.7.3", features = ["graph", "storage", "meta"] }

# bb8
bb8 = { version = "0.8" }
bb8-nebula = { version = "0.9", features = ["graph"] }

# common
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }

When I run cargo run 127.0.0.1 9669 root 'password', it raised an error: Error: DataDeserializeError(DataDeserializeError { field: None, kind: Custom("missing fieldHTTP port") }).

I found that in this repo, the code in nebula-client/src/v3/graph/client.rs is written like this:

const STMT_SHOW_HOSTS: &[u8] = b"SHOW HOSTS;";
#[derive(Deserialize, Debug)]
pub struct Host {
    #[serde(rename(deserialize = "Host"))]
    pub host: String,
    #[serde(rename(deserialize = "Port"))]
    pub port: u16,
    // #[serde(rename(deserialize = "HTTP port"))]
    // pub http_port: u16,
    #[serde(rename(deserialize = "Status"))]
    pub status: String,
    #[serde(rename(deserialize = "Leader count"))]
    pub leader_count: u64,
    #[serde(rename(deserialize = "Leader distribution"))]
    pub leader_distribution: String,
    #[serde(rename(deserialize = "Partition distribution"))]
    pub partition_distribution: String,
    #[serde(rename(deserialize = "Version"))]
    pub version: String,
}

And in crates.io code is like this:

const STMT_SHOW_HOSTS: &[u8] = b"SHOW HOSTS;";
#[derive(Deserialize, Debug)]
pub struct Host {
    #[serde(rename(deserialize = "Host"))]
    pub host: String,
    #[serde(rename(deserialize = "Port"))]
    pub port: u16,
    #[serde(rename(deserialize = "HTTP port"))]
    pub http_port: u16,
    #[serde(rename(deserialize = "Status"))]
    pub status: String,
    #[serde(rename(deserialize = "Leader count"))]
    pub leader_count: u64,
    #[serde(rename(deserialize = "Leader distribution"))]
    pub leader_distribution: String,
    #[serde(rename(deserialize = "Partition distribution"))]
    pub partition_distribution: String,
    #[serde(rename(deserialize = "Version"))]
    pub version: String,
}

After I commented http_port, the code can run successfully.

So why is the code in this repo inconsistent with crates.io? What is this http_port used for? Can it be deleted?

GG2002 commented 3 months ago

I noticed nebula-client in crates.io was published by vkill, what's the relationship between github.com/bk-rs/nebula-rs and this repo? I wanna do some work for nebula-client, which repo should I commit for?

Nicole00 commented 2 months ago

I believe the correct one is nebula-client/src/v3/graph/client.rs, because it is the same with result of "show hosts".

image

the http port looks like useless, you can delete it. For nebula client in crates.io, maybe there's a extra useless field http port in old version.

GG2002 commented 2 months ago

the http port looks like useless, you can delete it. For nebula client in crates.io, maybe there's a extra useless field http port in old version.

Thanks for your reply. I got it. So do you know which repo should I contribute for? I wanna add result set for nebula-client, just like nebula-go and nebula-python do. If I contribute for vesoft-inc/nebula-rust, will these changes be updated in crates.io?

Nicole00 commented 2 months ago

You can submit some pull requests for repo https://github.com/vesoft-inc/nebula-rust, It's very welcome~~~ When we deploy the nebula-rust with new version, the changes will be updated to crates.io.

GG2002 commented 2 months ago

It's good.