Skip to content

Commit

Permalink
Update Zenoh to 0.7.2-rc and zenoh-rpc to 0.7.0-alpha.1
Browse files Browse the repository at this point in the history
The main changes involve:
- moving the common dependencies to the workspace Cargo.toml
- sorted the different Cargo.toml alphabetically
- updated the Rust toolchain to the same version as zenoh 0.7.2-rc: 1.69.0
- changed the identifiers of the instances to `ZenohId` (instead of `Uuid`)
- have the `get_machine_uuid` function return a `ZenohId`
- changed the name of the shared library of the plugin to
  `zenoh_plugin_zenoh_flow` (as expected by zenoh 0.7.2-rc)
- fixed the path of the `SharedMemoryManager` — changed in zenoh 0.7.2-rc
- changed `deserialize_size` and `deserialize_time` to not fail when no value is
  provided — as it is expected to not provide any value for these configurations

Signed-off-by: Julien Loudet <[email protected]>
  • Loading branch information
J-Loudet committed Jul 6, 2023
1 parent c8875d3 commit e1518ba
Show file tree
Hide file tree
Showing 17 changed files with 128 additions and 93 deletions.
11 changes: 11 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ license = " EPL-2.0 OR Apache-2.0"
readme = "README.md"
repository = "https://github.com/eclipse-zenoh/zenoh-flow"

[workspace.dependencies]
zenoh = { version = "0.7.2-rc" }
zenoh-sync = { version = "0.7.2-rc" }
zenoh-util = { version = "0.7.2-rc" }
zenoh-collections = { version = "0.7.2-rc" }
zenoh-core = { version = "0.7.2-rc" }
zenoh-ext = { version = "0.7.2-rc" }
zenoh-plugin-trait = { version = "0.7.2-rc", default-features = false }
zrpc = { version = "0.7.0-alpha.1" }
zrpc-macros = { version = "0.7.0-alpha.1" }


[profile.dev]
debug=true
Expand Down
18 changes: 9 additions & 9 deletions cargo-zenoh-flow/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ repository.workspace = true

[dependencies]
async-std = { version = "=1.12.0", features = ["attributes"] }
zenoh = { version = "=0.7.0-rc", optional = true}
zenoh-util = { version = "=0.7.0-rc", optional = true }
zenoh-flow = {path = "../zenoh-flow", version = "=0.5.0-dev"}
cargo_toml = "0.13"
clap = { version = "4.0", features = ["derive"] }
serde_derive = "1.0"
colored = "2"
rand = { version = "0.8", optional = true}
serde = { version = "1.0", features = ["derive"] }
cargo_toml = "0.13"
toml = "0.5.8"
serde_yaml = {version = "0.9"}
serde_derive = "1.0"
serde_json = "1.0"
rand = { version = "0.8", optional = true}
serde_yaml = {version = "0.9"}
tinytemplate = "1.2"
colored = "2"
toml = "0.5.8"
zenoh = { workspace = true, optional = true}
zenoh-flow = { path = "../zenoh-flow", version = "=0.5.0-dev" }
zenoh-util = { workspace = true, optional = true }


[[bin]]
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.66.0
1.69.0
8 changes: 4 additions & 4 deletions zenoh-flow-daemon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ log = "0.4"
async-std = { version = "=1.12.0", features = ["attributes"] }
uuid = { version = "1.1", features = ["serde", "v4"] }
uhlc = "0.5.1"
zenoh = { version = "=0.7.0-rc" }
zenoh-util = { version = "=0.7.0-rc" }
zrpc = { version= "=0.6.1-alpha.2" }
zrpc-macros = { version= "=0.6.1-alpha.2" }
zenoh = { workspace = true }
zenoh-util = { workspace = true }
zrpc = { workspace = true }
zrpc-macros = { workspace = true }
clap = { version = "4.0", features = ["derive"] }
hostname = "0.3.1"
machine-uid = "0.2.0"
Expand Down
25 changes: 17 additions & 8 deletions zenoh-flow-daemon/src/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ use async_std::sync::RwLock;
// use futures::stream::{AbortHandle, Abortable, Aborted};
use serde::{Deserialize, Serialize};
use std::sync::Arc;
use uhlc::{HLCBuilder, ID};
use uhlc::HLCBuilder;
use uuid::Uuid;
use zenoh::prelude::ZenohId;

use zenoh_flow::model::descriptor::{
FlattenDataFlowDescriptor, OperatorDescriptor, SinkDescriptor, SourceDescriptor,
Expand Down Expand Up @@ -64,7 +65,7 @@ pub struct DaemonConfig {
/// Name of the runtime, if None the hostname will be used.
pub name: Option<String>,
/// Uuid of the runtime, if None the machine id will be used.
pub uuid: Option<Uuid>,
pub uuid: Option<ZenohId>,
/// Where to find the Zenoh configuration file
pub zenoh_config: Option<String>,
/// Where to locate the extension files.
Expand Down Expand Up @@ -101,11 +102,17 @@ pub struct Daemon {
///
/// # Errors
/// Returns an error variant if unable to get or parse the Uuid.
pub fn get_machine_uuid() -> ZFResult<Uuid> {
let machine_id_raw =
pub fn get_machine_uuid() -> ZFResult<ZenohId> {
let mut machine_id_raw =
machine_uid::get().map_err(|e| zferror!(ErrorKind::ParsingError, "{}", e))?;
let node_str: &str = &machine_id_raw;
Uuid::parse_str(node_str).map_err(|e| zferror!(ErrorKind::ParsingError, e).into())

// To conform to the ZenohId, the machine_id should:
// 1. not contain capital letters,
machine_id_raw.make_ascii_lowercase();
// 2. not contain dashes.
let valid_machine_id = machine_id_raw.split('-').collect::<String>();

valid_machine_id.parse::<ZenohId>()
}

/// Creates a new `Daemon` from a configuration file.
Expand Down Expand Up @@ -280,8 +287,10 @@ impl Daemon {
};

// Creates the HLC.
let uhlc_id = ID::try_from(uuid.as_bytes())
.map_err(|e| zferror!(ErrorKind::InvalidData, "Unable to create ID {:?}", e))?;
let uhlc_id = uuid
.to_string()
.parse::<uhlc::ID>()
.map_err(|e| zferror!(ErrorKind::InvalidData, "Invalid uHLC ID {:?}", e))?;
let hlc = Arc::new(HLCBuilder::new().with_id(uhlc_id).build());

// Creates the loader.
Expand Down
22 changes: 11 additions & 11 deletions zenoh-flow-plugin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,32 @@ readme.workspace = true
repository.workspace = true

[lib]
name = "zplugin_zenoh_flow"
name = "zenoh_plugin_zenoh_flow"
crate-type = ["cdylib"]

[features]
no_mangle = ["zenoh-plugin-trait/no_mangle"]
default = ["no_mangle"]

[dependencies]
async-trait = "0.1.57"
async-std = "=1.12.0"
async-trait = "0.1.57"
clap = "4.0"
env_logger = "0.10"
futures = "0.3.24"
flume = "0.10.14"
futures = "0.3.24"
git-version = "0.3.5"
lazy_static = "1.4.0"
log = "0.4.17"
serde = { version = "1.0", features = ["derive", "rc"] }
serde_json = "1.0"
lazy_static = "1.4.0"
git-version = "0.3.5"
zenoh = { version = "=0.7.0-rc", features = ["unstable"] }
zenoh-collections = { version = "=0.7.0-rc" }
zenoh-core = { version = "=0.7.0-rc" }
zenoh-ext = { version = "=0.7.0-rc", features = ["unstable"] }
zenoh-plugin-trait = { version = "=0.7.0-rc", default-features = false }
zenoh-flow-daemon = {version = "=0.5.0-dev", path = "../zenoh-flow-daemon"}
zenoh = { workspace = true, features = ["unstable"] }
zenoh-collections = { workspace = true }
zenoh-core = { workspace = true }
zenoh-ext = { workspace = true, features = ["unstable"] }
zenoh-flow = {version = "=0.5.0-dev", path = "../zenoh-flow"}
zenoh-flow-daemon = {version = "=0.5.0-dev", path = "../zenoh-flow-daemon"}
zenoh-plugin-trait = { workspace = true, default-features = false }

[build-dependencies]
rustc_version = "0.4"
Expand Down
12 changes: 6 additions & 6 deletions zenoh-flow/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ typetag = "0.2"
uhlc = "0.5.1"
url = "2.2"
uuid = { version = "1.1", features = ["serde", "v4"] }
zenoh = { version = "=0.7.0-rc", features = ["shared-memory"]}
zenoh-flow-derive = {version = "=0.5.0-dev", path = "../zenoh-flow-derive"}
zenoh-sync = { version = "=0.7.0-rc" }
zenoh-util = { version = "=0.7.0-rc" }
zrpc = { version= "=0.6.1-alpha.2" }
zrpc-macros = { version= "=0.6.1-alpha.2" }
zenoh = { workspace = true, features = ["shared-memory"] }
zenoh-flow-derive = { version = "=0.5.0-dev", path = "../zenoh-flow-derive" }
zenoh-sync = { workspace = true }
zenoh-util = { workspace = true }
zrpc = { workspace = true }
zrpc-macros = { workspace = true }

[dev-dependencies]
tempdir = "0.3.7"
Expand Down
5 changes: 3 additions & 2 deletions zenoh-flow/src/runtime/dataflow/instance/builtin/zenoh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ use futures::{future::select_all, Future};
use std::mem;
use std::sync::Arc;
use std::{collections::HashMap, pin::Pin};
use zenoh::buffers::SharedMemoryManager;
use zenoh::{prelude::r#async::*, publication::Publisher, subscriber::Subscriber};
use zenoh::{
prelude::r#async::*, publication::Publisher, shm::SharedMemoryManager, subscriber::Subscriber,
};

/// Key for the key expressions used by the built-in Source/Sink.
static KEY_KEYEXPRESSIONS: &str = "key-expressions";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ use async_trait::async_trait;
use flume::Receiver;
use std::sync::atomic::AtomicU64;
use std::sync::Arc;
use zenoh::buffers::SharedMemoryManager;
use zenoh::prelude::r#async::*;
use zenoh::shm::SharedMemoryManager;
use zenoh::subscriber::Subscriber;
use zenoh_util::core::AsyncResolve;

Expand Down
13 changes: 7 additions & 6 deletions zenoh-flow/src/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use crate::model::record::DataFlowRecord;
use serde::{Deserialize, Serialize};
use std::sync::Arc;
use uuid::Uuid;
use zenoh::prelude::ZenohId;

use self::dataflow::loader::LoaderConfig;
use crate::runtime::dataflow::loader::Loader;
Expand All @@ -49,7 +50,7 @@ pub struct RuntimeContext {
pub loader: Arc<Loader>,
pub hlc: Arc<HLC>,
pub runtime_name: RuntimeId,
pub runtime_uuid: Uuid,
pub runtime_uuid: ZenohId,
pub shared_memory_element_size: usize,
pub shared_memory_elements: usize,
pub shared_memory_backoff: u64,
Expand Down Expand Up @@ -124,7 +125,7 @@ pub enum RuntimeStatusKind {
/// The Runtime information.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct RuntimeInfo {
pub id: Uuid,
pub id: ZenohId,
pub name: Arc<str>,
pub tags: Vec<String>,
pub status: RuntimeStatusKind,
Expand All @@ -134,7 +135,7 @@ pub struct RuntimeInfo {
/// The detailed runtime status.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct RuntimeStatus {
pub id: Uuid,
pub id: ZenohId,
pub running_flows: usize,
pub running_operators: usize,
pub running_sources: usize,
Expand Down Expand Up @@ -186,7 +187,7 @@ pub struct RuntimeConfig {
pub pid_file: String, //Where the PID file resides
pub path: String, //Where the libraries are downloaded/located
pub name: String,
pub uuid: Uuid,
pub uuid: ZenohId,
pub loader: LoaderConfig,
}

Expand Down Expand Up @@ -353,7 +354,7 @@ impl Job {
#[zservice(
timeout_s = 60,
prefix = "zf/daemon",
service_uuid = "00000000-0000-0000-0000-000000000001"
service_uuid = "11111111111111111111111111111111"
)]
pub trait DaemonInterface {
/// Creates an instance of the given [`FlattenDataFlowDescriptor`][^note].
Expand Down Expand Up @@ -545,7 +546,7 @@ pub trait DaemonInterface {
#[zservice(
timeout_s = 600,
prefix = "zf/daemon",
service_uuid = "00000000-0000-0000-0000-000000000002"
service_uuid = "22222222222222222222222222222222"
)]
pub trait DaemonInterfaceInternal {
/// Prepares the runtime host the instance identified by the [`Uuid`].
Expand Down
Loading

0 comments on commit e1518ba

Please sign in to comment.