Skip to content

Commit

Permalink
montblanc: clippy + move dependencies to workspace Cargo.toml
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Loudet <julien.loudet@zettascale.tech>
  • Loading branch information
J-Loudet committed Jul 17, 2023
1 parent 77dffe8 commit 56d126b
Show file tree
Hide file tree
Showing 32 changed files with 217 additions and 261 deletions.
9 changes: 7 additions & 2 deletions montblanc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,10 @@ codegen-units=1
opt-level=3
panic="abort"

[patch.crates-io]
zenoh-flow = { git = "https://github.com/eclipse-zenoh/zenoh-flow.git", branch = "master"}
[workspace.dependencies]
async-std = { version = "=1.12.0", features = ["attributes"] }
async-trait = "0.1.50"
futures = "0.3.28"
prost = "0.11"
rand = "0.8.0"
zenoh-flow = "0.5.0-alpha.1"
8 changes: 4 additions & 4 deletions montblanc/arequipa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ crate-type=["cdylib"]
path="src/lib.rs"

[dependencies]
async-std = { workspace = true }
async-trait = { workspace = true }
datatypes = { path = "../datatypes" }
async-std = { version = "=1.12.0", features = ["attributes"] }
async-trait = "0.1.50"
zenoh-flow = "0.5.0-dev"
prost = "0.11"
prost = { workspace = true }
zenoh-flow = { workspace = true }
12 changes: 6 additions & 6 deletions montblanc/barcelona/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ crate-type=["cdylib"]
path="src/lib.rs"

[dependencies]
async-std = { version = "=1.12.0", features = ["attributes"] }
async-std = { workspace = true }
async-trait = { workspace = true }
datatypes = { path = "../datatypes" }
async-trait = "0.1.50"
zenoh-flow = "0.5.0-dev"
futures = "0.3.5"
rand = "0.8.0"
prost = "0.11"
futures = { workspace = true }
prost = { workspace = true }
rand = { workspace = true }
zenoh-flow = { workspace = true }
56 changes: 27 additions & 29 deletions montblanc/barcelona/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use datatypes::data_types;
use datatypes::{LENA_PORT, MEKONG_PORT};
use futures::prelude::*;
use futures::select;
use prost::Message;
use prost::Message as pMessage;
use rand::random;
use zenoh_flow::prelude::*;

Expand Down Expand Up @@ -54,34 +54,32 @@ impl Operator for Barcelona {
impl Node for Barcelona {
async fn iteration(&self) -> Result<()> {
select! {
msg = self.input_mekong.recv().fuse() => {
if let Ok((msg, _ts)) = msg {
if let zenoh_flow::prelude::Message::Data(data) = msg {
let value = data_types::WrenchStamped {
header: Some(data.header.clone().unwrap_or(random())),
wrench: Some(data_types::Wrench {
force: data
.twist
.as_ref()
.ok_or_else(|| zferror!(ErrorKind::Empty))?
.twist
.as_ref()
.ok_or_else(|| zferror!(ErrorKind::Empty))?
.linear
.clone(),
torque: data
.twist
.as_ref()
.ok_or_else(|| zferror!(ErrorKind::Empty))?
.twist
.as_ref()
.ok_or_else(|| zferror!(ErrorKind::Empty))?
.angular
.clone(),
}),
};
self.output_lena.send(value, None).await?;
}
msg = self.input_mekong.recv().fuse() => {
if let Ok((Message::Data(data), _ts)) = msg {
let value = data_types::WrenchStamped {
header: Some(data.header.clone().unwrap_or(random())),
wrench: Some(data_types::Wrench {
force: data
.twist
.as_ref()
.ok_or_else(|| zferror!(ErrorKind::Empty))?
.twist
.as_ref()
.ok_or_else(|| zferror!(ErrorKind::Empty))?
.linear
.clone(),
torque: data
.twist
.as_ref()
.ok_or_else(|| zferror!(ErrorKind::Empty))?
.twist
.as_ref()
.ok_or_else(|| zferror!(ErrorKind::Empty))?
.angular
.clone(),
}),
};
self.output_lena.send(value, None).await?;
}
}
}
Expand Down
11 changes: 5 additions & 6 deletions montblanc/cordoba/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ crate-type=["cdylib"]
path="src/lib.rs"

[dependencies]
async-std = { version = "=1.12.0", features = ["attributes"] }
async-std = { workspace = true }
async-trait = { workspace = true }
datatypes = { path = "../datatypes" }

async-trait = "0.1.50"
zenoh-flow = "0.5.0-dev"
rand = "0.8.0"
prost = "0.11"
prost = { workspace = true }
rand = { workspace = true }
zenoh-flow = { workspace = true }
12 changes: 7 additions & 5 deletions montblanc/datatypes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ version = "0.1.0"
edition = "2018"

[dependencies]
bytes = "1.1"
prost = "0.11"
rand = "0.8.4"
prost-build = "0.11"
async-std = { workspace = true }
async-trait = { workspace = true }
chrono = "0.4"
zenoh-flow = "0.5.0-dev"
futures = { workspace = true }
prost = { workspace = true }
prost-build = "0.11"
rand = { workspace = true }
zenoh-flow = { workspace = true }

[build-dependencies]
prost-build = "0.11"
Expand Down
12 changes: 6 additions & 6 deletions montblanc/delhi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ crate-type=["cdylib"]
path="src/lib.rs"

[dependencies]
async-std = { version = "=1.12.0", features = ["attributes"] }
datatypes = { path = "../datatypes" }

async-trait = "0.1.50"
zenoh-flow = "0.5.0-dev"
rand = "0.8.0"
prost = "0.11"
async-std = { workspace = true }
async-trait = { workspace = true }
datatypes = { path = "../datatypes" }
prost = { workspace = true }
rand = { workspace = true }
zenoh-flow = { workspace = true }
10 changes: 5 additions & 5 deletions montblanc/freeport/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ crate-type=["cdylib"]
path="src/lib.rs"

[dependencies]
async-std = { version = "=1.12.0", features = ["attributes"] }
async-std = { workspace = true }
async-trait = { workspace = true }
datatypes = { path = "../datatypes" }
prost = "0.11"
async-trait = "0.1.50"
zenoh-flow = "0.5.0-dev"
rand = "0.8.0"
prost = { workspace = true }
rand = { workspace = true }
zenoh-flow = { workspace = true }
12 changes: 6 additions & 6 deletions montblanc/geneva/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ crate-type=["cdylib"]
path="src/lib.rs"

[dependencies]
async-std = { version = "=1.12.0", features = ["attributes"] }
async-std = { workspace = true }
async-trait = { workspace = true }
datatypes = { path = "../datatypes" }
prost = "0.11"
async-trait = "0.1.50"
zenoh-flow = "0.5.0-dev"
futures = "0.3.5"
rand = "0.8.0"
futures = { workspace = true }
prost = { workspace = true }
rand = { workspace = true }
zenoh-flow = { workspace = true }

21 changes: 7 additions & 14 deletions montblanc/geneva/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use datatypes::data_types;
use datatypes::{ARKANSAS_PORT, CONGO_PORT, DANUBE_PORT, PARANA_PORT, TAGUS_PORT};
use futures::prelude::*;
use futures::select;
use prost::Message;
use prost::Message as _;
use rand::random;
use std::sync::Arc;
use zenoh_flow::prelude::*;
Expand Down Expand Up @@ -86,36 +86,29 @@ impl Node for Geneva {
async fn iteration(&self) -> Result<()> {
select! {
msg = self.input_danube.recv().fuse() => {
if let Ok((msg, _ts)) = msg {
if let zenoh_flow::prelude::Message::Data(inner_data) = msg {
self.state.lock().await.danube_last_val = (*inner_data).clone();
}
if let Ok((Message::Data(inner_data), _ts)) = msg {
self.state.lock().await.danube_last_val = (*inner_data).clone();
}
},
msg = self.input_tagus.recv().fuse() => {
if let Ok((msg, _ts)) = msg {
if let zenoh_flow::prelude::Message::Data(inner_data) = msg {
if let Ok((Message::Data(inner_data), _ts)) = msg {
self.state.lock().await.tagus_last_val = (*inner_data).clone();
}
}
},
msg = self.input_congo.recv().fuse() => {
if let Ok((msg, _ts)) = msg {
if let zenoh_flow::prelude::Message::Data(inner_data) = msg {
if let Ok((Message::Data(inner_data), _ts)) = msg {
self.state.lock().await.congo_last_val = (*inner_data).clone();
}}
}
},
msg = self.input_parana.recv().fuse() => {
if let Ok((msg, _ts)) = msg {
if let zenoh_flow::prelude::Message::Data(inner_data) = msg {
if let Ok((Message::Data(inner_data), _ts)) = msg {
let value = data_types::String {
value: format!("geneva/arkansas:{}", inner_data.value),
};

self.output_arkansas.send(value, None).await?;
}
}
}
}
Ok(())
}
Expand Down
12 changes: 6 additions & 6 deletions montblanc/georgetown/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ crate-type=["cdylib"]
path="src/lib.rs"

[dependencies]
async-std = { version = "=1.12.0", features = ["attributes"] }
async-std = { workspace = true }
async-trait = { workspace = true }
datatypes = { path = "../datatypes" }
prost = "0.11"
async-trait = "0.1.50"
zenoh-flow = "0.5.0-dev"
futures = "0.3.5"
rand = "0.8.0"
futures = { workspace = true }
prost = { workspace = true }
rand = { workspace = true }
zenoh-flow = { workspace = true }
10 changes: 3 additions & 7 deletions montblanc/georgetown/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use datatypes::data_types;
use datatypes::{LENA_PORT, MURRAY_PORT, VOLGA_PORT};
use futures::prelude::*;
use futures::select;
use prost::Message;
use prost::Message as pMessage;
use rand::random;
use std::sync::Arc;
use std::time::Duration;
Expand Down Expand Up @@ -77,18 +77,14 @@ impl Node for Georgetown {
async fn iteration(&self) -> Result<()> {
select! {
msg = self.input_murray.recv().fuse() => {
if let Ok((msg, _ts)) = msg {
if let zenoh_flow::prelude::Message::Data(inner_data) = msg {
if let Ok((Message::Data(inner_data), _ts)) = msg {
self.state.lock().await.murray_last_val = (*inner_data).clone();
}
}
},
msg = self.input_lena.recv().fuse() => {
if let Ok((msg, _ts)) = msg {
if let zenoh_flow::prelude::Message::Data(inner_data) = msg {
if let Ok((Message::Data(inner_data), _ts)) = msg {
self.state.lock().await.lena_last_val = (*inner_data).clone();
}
}
},
// Output every 50ms
_ = async_std::task::sleep(Duration::from_millis(50)).fuse() => {
Expand Down
10 changes: 5 additions & 5 deletions montblanc/hamburg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ crate-type=["cdylib"]
path="src/lib.rs"

[dependencies]
async-std = { version = "=1.12.0", features = ["attributes"] }
async-std = { workspace = true }
async-trait = { workspace = true }
datatypes = { path = "../datatypes" }
prost = "0.11"
async-trait = "0.1.50"
zenoh-flow = "0.5.0-dev"
futures = "0.3.5"
futures = { workspace = true }
prost = { workspace = true }
zenoh-flow = { workspace = true }

18 changes: 5 additions & 13 deletions montblanc/hamburg/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use datatypes::data_types;
use datatypes::{DANUBE_PORT, GANGES_PORT, NILE_PORT, PARANA_PORT, TIGRIS_PORT};
use futures::prelude::*;
use futures::select;
use prost::Message;
use prost::Message as pMessage;
use std::sync::Arc;
use zenoh_flow::prelude::*;

Expand Down Expand Up @@ -84,36 +84,28 @@ impl Node for Hamburg {
async fn iteration(&self) -> Result<()> {
select! {
msg = self.input_tigris.recv().fuse() => {
if let Ok((msg, _ts)) = msg {
if let zenoh_flow::prelude::Message::Data(inner_data) = msg {
if let Ok((Message::Data(inner_data), _ts)) = msg {
self.state.lock().await.tigris_last_val = inner_data.value;
}
}
},
msg = self.input_ganges.recv().fuse() => {
if let Ok((msg, _ts)) = msg {
if let zenoh_flow::prelude::Message::Data(inner_data) = msg {
if let Ok((Message::Data(inner_data), _ts)) = msg {
self.state.lock().await.ganges_last_val = inner_data.value;
}
}
},
msg = self.input_nile.recv().fuse() => {
if let Ok((msg, _ts)) = msg {
if let zenoh_flow::prelude::Message::Data(inner_data) = msg {
if let Ok((Message::Data(inner_data), _ts)) = msg {
self.state.lock().await.nile_last_val = inner_data.value;
}
}
},
msg = self.input_danube.recv().fuse() => {
if let Ok((msg, _ts)) = msg {
if let zenoh_flow::prelude::Message::Data(inner_data) = msg {
if let Ok((Message::Data(inner_data), _ts)) = msg {
let new_value = data_types::String {
value: format!("hamburg/parana:{}", inner_data.value)
};
self.output_parana.send(new_value, None).await?;
}
}
}
}
Ok(())
}
Expand Down
10 changes: 5 additions & 5 deletions montblanc/hebron/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ crate-type=["cdylib"]
path="src/lib.rs"

[dependencies]
async-std = { version = "=1.12.0", features = ["attributes"] }
async-std = { workspace = true }
async-trait = { workspace = true }
datatypes = { path = "../datatypes" }
prost = "0.11"
async-trait = "0.1.50"
zenoh-flow = "0.5.0-dev"
rand = "0.8.0"
prost = { workspace = true }
rand = { workspace = true }
zenoh-flow = { workspace = true }
Loading

0 comments on commit 56d126b

Please sign in to comment.