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
Add flitering of versions. #18
Conversation
Do you mean the operator I used? If so I think it correct. |
|
https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.filter |
negy-gateway/src/main.rs
Outdated
@@ -55,6 +58,14 @@ async fn fetch_nodes_unselected(node_pool_endpoint: &str) -> Result<Vec<NodeUnse | |||
name: n.name, | |||
version: n.version, | |||
}) | |||
.filter(|n| { | |||
if let Some(min_version) = &args.min_version { | |||
n.version.parse::<i32>().unwrap() >= min_version.parse::<i32>().unwrap() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't parse as i32 but add semver
crate and parse as Version. https://docs.rs/semver/latest/semver/
Should I focus on resolving the conflict now? |
Sure! |
Okay, I got the conflict resolved. |
Nice! The last thing you have to do it add semver create as I wrote. |
Okay empty lines removed. |
Thxs. Please add semver crate as I mentioned. |
All right, it now uses the semver crate. |
negy-gateway/src/main.rs
Outdated
) -> Result<()> { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty line added
negy-gateway/src/main.rs
Outdated
@@ -124,11 +135,13 @@ async fn main() -> Result<()> { | |||
|
|||
let listener = TcpListener::bind(bind_addr).await?; | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty line added
negy-gateway/src/main.rs
Outdated
@@ -24,6 +25,8 @@ struct Args { | |||
hops: usize, | |||
#[clap(short, long, value_parser)] | |||
auth_token: Option<String>, | |||
min_version: Option<String>, | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty line added
Looks good!! After you removing the empty lines, I gonna merge this! |
Hang on, I forgot to update the cargo files, let me do that before you merge. |
Okay got those updated, and empty lines removed. |
Yup. thanks |
I think you need to add semver both of /Cargo.toml and /negy-gateway/Cargo.toml. Please confirm your code could be compiled and run successfully. Also, please do not commit any changes which is meaningless in this pull request. Like adding empty lines and removing existing codes. Thanks. |
I did fix that one file. Not sure why that happened. And yes, |
Hey @Darth-Ness, I would like to finish this PR for the next release so I created a new PR to fix this. #22 |
That's good, go ahead and merge it whenever your ready. Do you want me to close this? |
I merged this! Thanks for the contribution!! 🎉 Your name will be listed. |
Unfortunately, I wasn't able to confirm it works. It does at least compile without errors. Let me know if you want me to change anything.