-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refacto(BREAKING): move nodes traits/declaration in their own crate
**BREAKING**: the macros defined in the crate `zenoh-flow-derive` were updated to take into account this refactoring. Hence, current code that uses `zenoh-flow` as a dependency will have their macro `export_xxx` fail at compilation time. The docstring withing the `zenoh-flow` crate have been ignored as a result. ----- All the logic that is related to creating nodes will sit in this crate. This separate crate will allow users to not have to compile Zenoh-Flow (and even Zenoh) when compiling their nodes. This should lead to greatly decreased compilation times. Several aspects are still work-in-progress: - the `Context` structure probably needs to be refined, - documentation is still sparse. Signed-off-by: Julien Loudet <julien.loudet@zettascale.tech>
- Loading branch information
Showing
17 changed files
with
2,390 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# | ||
# Copyright (c) 2021 - 2023 ZettaScale Technology | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Eclipse Public License 2.0 which is available at | ||
# http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
# which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
# | ||
# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
# | ||
# Contributors: | ||
# ZettaScale Zenoh Team, <zenoh@zettascale.tech> | ||
# | ||
|
||
[package] | ||
authors = { workspace = true } | ||
categories = { workspace = true } | ||
description = "Internal crate for Zenoh-Flow." | ||
edition = { workspace = true } | ||
homepage = { workspace = true } | ||
license = { workspace = true } | ||
name = "zenoh-flow-nodes" | ||
repository = { workspace = true } | ||
version = { workspace = true } | ||
|
||
[dependencies] | ||
anyhow = { workspace = true } | ||
async-trait = { workspace = true } | ||
bincode = { version = "1.3" } | ||
flume = { workspace = true } | ||
futures = { workspace = true } | ||
proc-macro-error = "1.0.4" | ||
proc-macro2 = "1.0" | ||
quote = "1.0" | ||
serde = { workspace = true } | ||
tracing = { workspace = true } | ||
uhlc = { workspace = true } | ||
uuid = { workspace = true } | ||
zenoh-flow-commons = { workspace = true } | ||
zenoh-flow-derive = { path = "../zenoh-flow-derive" } | ||
|
||
[dev-dependencies] | ||
prost = "0.12" | ||
serde_json = { workspace = true } | ||
|
||
[build-dependencies] | ||
rustc_version = "0.4.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// Copyright (c) 2021 - 2023 ZettaScale Technology | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Eclipse Public License 2.0 which is available at | ||
// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
// which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
// | ||
// Contributors: | ||
// ZettaScale Zenoh Team, <zenoh@zettascale.tech> | ||
// | ||
|
||
fn main() { | ||
let version = rustc_version::version().unwrap(); | ||
println!("cargo:rustc-env=RUSTC_VERSION={version}"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// | ||
// Copyright (c) 2021 - 2023 ZettaScale Technology | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Eclipse Public License 2.0 which is available at | ||
// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
// which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
// | ||
// Contributors: | ||
// ZettaScale Zenoh Team, <zenoh@zettascale.tech> | ||
// | ||
|
||
use std::{pin::Pin, sync::Arc}; | ||
|
||
use futures::Future; | ||
use zenoh_flow_commons::{Configuration, Result}; | ||
|
||
use crate::{ | ||
prelude::{Inputs, Node, Outputs}, | ||
Context, | ||
}; | ||
|
||
/// Constant used to check if a node is compatible with the currently running Zenoh Flow daemon. | ||
/// As nodes are dynamically loaded, this is to prevent (possibly cryptic) runtime error due to | ||
/// incompatible API. | ||
pub static CORE_VERSION: &str = env!("CARGO_PKG_VERSION"); | ||
/// Constant used to check if a node was compiled with the same version of the Rust compiler than | ||
/// the currently running Zenoh Flow daemon. | ||
/// As Rust is not ABI stable, this is to prevent (possibly cryptic) runtime errors. | ||
pub static RUSTC_VERSION: &str = env!("RUSTC_VERSION"); | ||
|
||
/// Declaration expected in the library that will be loaded. | ||
pub struct NodeDeclaration<C> { | ||
pub rustc_version: &'static str, | ||
pub core_version: &'static str, | ||
pub constructor: C, | ||
} | ||
|
||
/// `SourceFn` is the only signature we accept to construct a [`Source`](`crate::prelude::Source`). | ||
pub type SourceFn = fn( | ||
Context, | ||
Option<Configuration>, | ||
Outputs, | ||
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Node>>> + Send>>; | ||
|
||
/// `OperatorFn` is the only signature we accept to construct an [`Operator`](`crate::prelude::Operator`). | ||
pub type OperatorFn = fn( | ||
Context, | ||
Option<Configuration>, | ||
Inputs, | ||
Outputs, | ||
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Node>>> + Send>>; | ||
|
||
/// `SinkFn` is the only signature we accept to construct a [`Sink`](`crate::prelude::Sink`). | ||
pub type SinkFn = fn( | ||
Context, | ||
Option<Configuration>, | ||
Inputs, | ||
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Node>>> + Send>>; |
Oops, something went wrong.