Browse Source

Merge pull request #127 from dora-rs/fix/getting_started

Fix and update Rust template to be ready after `dora new`
tags/v0.0.0-test-pr-131
Philipp Oppermann GitHub 3 years ago
parent
commit
f638b7507c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 78 additions and 68 deletions
  1. +25
    -24
      Cargo.lock
  2. +1
    -1
      binaries/cli/Cargo.toml
  3. +9
    -9
      binaries/cli/src/template/c/dataflow-template.yml
  4. +6
    -3
      binaries/cli/src/template/c/mod.rs
  5. +1
    -1
      binaries/cli/src/template/rust/Cargo-template.toml
  6. +12
    -12
      binaries/cli/src/template/rust/dataflow-template.yml
  7. +9
    -3
      binaries/cli/src/template/rust/mod.rs
  8. +1
    -1
      binaries/cli/src/template/rust/node/Cargo-template.toml
  9. +2
    -2
      binaries/cli/src/template/rust/node/main-template.rs
  10. +1
    -1
      binaries/cli/src/template/rust/operator/Cargo-template.toml
  11. +1
    -2
      binaries/cli/src/template/rust/operator/lib-template.rs
  12. +2
    -1
      binaries/coordinator/Cargo.toml
  13. +1
    -1
      binaries/coordinator/src/run/mod.rs
  14. +2
    -2
      binaries/runtime/Cargo.toml
  15. +2
    -2
      libraries/communication-layer/Cargo.toml
  16. +1
    -1
      libraries/core/Cargo.toml
  17. +2
    -2
      libraries/extensions/zenoh-logger/Cargo.toml

+ 25
- 24
Cargo.lock View File

@@ -912,6 +912,7 @@ dependencies = [
"tracing",
"tracing-subscriber",
"uuid 0.8.2",
"which",
"zenoh",
]

@@ -4422,13 +4423,13 @@ dependencies = [

[[package]]
name = "which"
version = "4.2.5"
version = "4.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c4fb54e6113b6a8772ee41c3404fb0301ac79604489467e0a9ce1f3e97c24ae"
checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b"
dependencies = [
"either",
"lazy_static",
"libc",
"once_cell",
]

[[package]]
@@ -4595,7 +4596,7 @@ dependencies = [
[[package]]
name = "zenoh"
version = "0.6.0-dev.0"
source = "git+https://github.com/eclipse-zenoh/zenoh.git#79a136e4fd90b11ff5d775ced981af53c4f1071b"
source = "git+https://github.com/eclipse-zenoh/zenoh.git?rev=79a136e4fd90b11ff5d775ced981af53c4f1071b#79a136e4fd90b11ff5d775ced981af53c4f1071b"
dependencies = [
"async-global-executor",
"async-std",
@@ -4639,7 +4640,7 @@ dependencies = [
[[package]]
name = "zenoh-buffers"
version = "0.6.0-dev.0"
source = "git+https://github.com/eclipse-zenoh/zenoh.git#79a136e4fd90b11ff5d775ced981af53c4f1071b"
source = "git+https://github.com/eclipse-zenoh/zenoh.git?rev=79a136e4fd90b11ff5d775ced981af53c4f1071b#79a136e4fd90b11ff5d775ced981af53c4f1071b"
dependencies = [
"async-std",
"bincode",
@@ -4654,7 +4655,7 @@ dependencies = [
[[package]]
name = "zenoh-cfg-properties"
version = "0.6.0-dev.0"
source = "git+https://github.com/eclipse-zenoh/zenoh.git#79a136e4fd90b11ff5d775ced981af53c4f1071b"
source = "git+https://github.com/eclipse-zenoh/zenoh.git?rev=79a136e4fd90b11ff5d775ced981af53c4f1071b#79a136e4fd90b11ff5d775ced981af53c4f1071b"
dependencies = [
"zenoh-core",
"zenoh-macros",
@@ -4663,7 +4664,7 @@ dependencies = [
[[package]]
name = "zenoh-collections"
version = "0.6.0-dev.0"
source = "git+https://github.com/eclipse-zenoh/zenoh.git#79a136e4fd90b11ff5d775ced981af53c4f1071b"
source = "git+https://github.com/eclipse-zenoh/zenoh.git?rev=79a136e4fd90b11ff5d775ced981af53c4f1071b#79a136e4fd90b11ff5d775ced981af53c4f1071b"
dependencies = [
"async-std",
"async-trait",
@@ -4676,7 +4677,7 @@ dependencies = [
[[package]]
name = "zenoh-config"
version = "0.6.0-dev.0"
source = "git+https://github.com/eclipse-zenoh/zenoh.git#79a136e4fd90b11ff5d775ced981af53c4f1071b"
source = "git+https://github.com/eclipse-zenoh/zenoh.git?rev=79a136e4fd90b11ff5d775ced981af53c4f1071b#79a136e4fd90b11ff5d775ced981af53c4f1071b"
dependencies = [
"flume",
"json5",
@@ -4694,7 +4695,7 @@ dependencies = [
[[package]]
name = "zenoh-core"
version = "0.6.0-dev.0"
source = "git+https://github.com/eclipse-zenoh/zenoh.git#79a136e4fd90b11ff5d775ced981af53c4f1071b"
source = "git+https://github.com/eclipse-zenoh/zenoh.git?rev=79a136e4fd90b11ff5d775ced981af53c4f1071b#79a136e4fd90b11ff5d775ced981af53c4f1071b"
dependencies = [
"anyhow",
"lazy_static",
@@ -4703,7 +4704,7 @@ dependencies = [
[[package]]
name = "zenoh-crypto"
version = "0.6.0-dev.0"
source = "git+https://github.com/eclipse-zenoh/zenoh.git#79a136e4fd90b11ff5d775ced981af53c4f1071b"
source = "git+https://github.com/eclipse-zenoh/zenoh.git?rev=79a136e4fd90b11ff5d775ced981af53c4f1071b#79a136e4fd90b11ff5d775ced981af53c4f1071b"
dependencies = [
"aes",
"hmac",
@@ -4716,7 +4717,7 @@ dependencies = [
[[package]]
name = "zenoh-link"
version = "0.6.0-dev.0"
source = "git+https://github.com/eclipse-zenoh/zenoh.git#79a136e4fd90b11ff5d775ced981af53c4f1071b"
source = "git+https://github.com/eclipse-zenoh/zenoh.git?rev=79a136e4fd90b11ff5d775ced981af53c4f1071b#79a136e4fd90b11ff5d775ced981af53c4f1071b"
dependencies = [
"async-std",
"async-trait",
@@ -4735,7 +4736,7 @@ dependencies = [
[[package]]
name = "zenoh-link-commons"
version = "0.6.0-dev.0"
source = "git+https://github.com/eclipse-zenoh/zenoh.git#79a136e4fd90b11ff5d775ced981af53c4f1071b"
source = "git+https://github.com/eclipse-zenoh/zenoh.git?rev=79a136e4fd90b11ff5d775ced981af53c4f1071b#79a136e4fd90b11ff5d775ced981af53c4f1071b"
dependencies = [
"async-std",
"async-trait",
@@ -4750,7 +4751,7 @@ dependencies = [
[[package]]
name = "zenoh-link-quic"
version = "0.6.0-dev.0"
source = "git+https://github.com/eclipse-zenoh/zenoh.git#79a136e4fd90b11ff5d775ced981af53c4f1071b"
source = "git+https://github.com/eclipse-zenoh/zenoh.git?rev=79a136e4fd90b11ff5d775ced981af53c4f1071b#79a136e4fd90b11ff5d775ced981af53c4f1071b"
dependencies = [
"async-std",
"async-trait",
@@ -4773,7 +4774,7 @@ dependencies = [
[[package]]
name = "zenoh-link-tcp"
version = "0.6.0-dev.0"
source = "git+https://github.com/eclipse-zenoh/zenoh.git#79a136e4fd90b11ff5d775ced981af53c4f1071b"
source = "git+https://github.com/eclipse-zenoh/zenoh.git?rev=79a136e4fd90b11ff5d775ced981af53c4f1071b#79a136e4fd90b11ff5d775ced981af53c4f1071b"
dependencies = [
"async-std",
"async-trait",
@@ -4788,7 +4789,7 @@ dependencies = [
[[package]]
name = "zenoh-link-tls"
version = "0.6.0-dev.0"
source = "git+https://github.com/eclipse-zenoh/zenoh.git#79a136e4fd90b11ff5d775ced981af53c4f1071b"
source = "git+https://github.com/eclipse-zenoh/zenoh.git?rev=79a136e4fd90b11ff5d775ced981af53c4f1071b#79a136e4fd90b11ff5d775ced981af53c4f1071b"
dependencies = [
"async-rustls",
"async-std",
@@ -4807,7 +4808,7 @@ dependencies = [
[[package]]
name = "zenoh-link-udp"
version = "0.6.0-dev.0"
source = "git+https://github.com/eclipse-zenoh/zenoh.git#79a136e4fd90b11ff5d775ced981af53c4f1071b"
source = "git+https://github.com/eclipse-zenoh/zenoh.git?rev=79a136e4fd90b11ff5d775ced981af53c4f1071b#79a136e4fd90b11ff5d775ced981af53c4f1071b"
dependencies = [
"async-std",
"async-trait",
@@ -4824,7 +4825,7 @@ dependencies = [
[[package]]
name = "zenoh-link-unixsock_stream"
version = "0.6.0-dev.0"
source = "git+https://github.com/eclipse-zenoh/zenoh.git#79a136e4fd90b11ff5d775ced981af53c4f1071b"
source = "git+https://github.com/eclipse-zenoh/zenoh.git?rev=79a136e4fd90b11ff5d775ced981af53c4f1071b#79a136e4fd90b11ff5d775ced981af53c4f1071b"
dependencies = [
"async-std",
"async-trait",
@@ -4849,7 +4850,7 @@ dependencies = [
[[package]]
name = "zenoh-macros"
version = "0.6.0-dev.0"
source = "git+https://github.com/eclipse-zenoh/zenoh.git#79a136e4fd90b11ff5d775ced981af53c4f1071b"
source = "git+https://github.com/eclipse-zenoh/zenoh.git?rev=79a136e4fd90b11ff5d775ced981af53c4f1071b#79a136e4fd90b11ff5d775ced981af53c4f1071b"
dependencies = [
"proc-macro2",
"quote",
@@ -4861,7 +4862,7 @@ dependencies = [
[[package]]
name = "zenoh-plugin-trait"
version = "0.6.0-dev.0"
source = "git+https://github.com/eclipse-zenoh/zenoh.git#79a136e4fd90b11ff5d775ced981af53c4f1071b"
source = "git+https://github.com/eclipse-zenoh/zenoh.git?rev=79a136e4fd90b11ff5d775ced981af53c4f1071b#79a136e4fd90b11ff5d775ced981af53c4f1071b"
dependencies = [
"libloading",
"log",
@@ -4874,7 +4875,7 @@ dependencies = [
[[package]]
name = "zenoh-protocol"
version = "0.6.0-dev.0"
source = "git+https://github.com/eclipse-zenoh/zenoh.git#79a136e4fd90b11ff5d775ced981af53c4f1071b"
source = "git+https://github.com/eclipse-zenoh/zenoh.git?rev=79a136e4fd90b11ff5d775ced981af53c4f1071b#79a136e4fd90b11ff5d775ced981af53c4f1071b"
dependencies = [
"log",
"uhlc 0.4.1",
@@ -4886,7 +4887,7 @@ dependencies = [
[[package]]
name = "zenoh-protocol-core"
version = "0.6.0-dev.0"
source = "git+https://github.com/eclipse-zenoh/zenoh.git#79a136e4fd90b11ff5d775ced981af53c4f1071b"
source = "git+https://github.com/eclipse-zenoh/zenoh.git?rev=79a136e4fd90b11ff5d775ced981af53c4f1071b#79a136e4fd90b11ff5d775ced981af53c4f1071b"
dependencies = [
"hex",
"lazy_static",
@@ -4899,7 +4900,7 @@ dependencies = [
[[package]]
name = "zenoh-sync"
version = "0.6.0-dev.0"
source = "git+https://github.com/eclipse-zenoh/zenoh.git#79a136e4fd90b11ff5d775ced981af53c4f1071b"
source = "git+https://github.com/eclipse-zenoh/zenoh.git?rev=79a136e4fd90b11ff5d775ced981af53c4f1071b#79a136e4fd90b11ff5d775ced981af53c4f1071b"
dependencies = [
"async-std",
"event-listener",
@@ -4912,7 +4913,7 @@ dependencies = [
[[package]]
name = "zenoh-transport"
version = "0.6.0-dev.0"
source = "git+https://github.com/eclipse-zenoh/zenoh.git#79a136e4fd90b11ff5d775ced981af53c4f1071b"
source = "git+https://github.com/eclipse-zenoh/zenoh.git?rev=79a136e4fd90b11ff5d775ced981af53c4f1071b#79a136e4fd90b11ff5d775ced981af53c4f1071b"
dependencies = [
"async-executor",
"async-global-executor",
@@ -4939,7 +4940,7 @@ dependencies = [
[[package]]
name = "zenoh-util"
version = "0.6.0-dev.0"
source = "git+https://github.com/eclipse-zenoh/zenoh.git#79a136e4fd90b11ff5d775ced981af53c4f1071b"
source = "git+https://github.com/eclipse-zenoh/zenoh.git?rev=79a136e4fd90b11ff5d775ced981af53c4f1071b#79a136e4fd90b11ff5d775ced981af53c4f1071b"
dependencies = [
"async-std",
"clap 2.34.0",


+ 1
- 1
binaries/cli/Cargo.toml View File

@@ -16,7 +16,7 @@ dora-core = { path = "../../libraries/core" }
serde_yaml = "0.9.11"
tempfile = "3.3.0"
webbrowser = "0.8.0"
zenoh = { git = "https://github.com/eclipse-zenoh/zenoh.git" }
zenoh = { git = "https://github.com/eclipse-zenoh/zenoh.git", rev = "79a136e4fd90b11ff5d775ced981af53c4f1071b" }
serde_json = "1.0.86"
termcolor = "1.1.3"
atty = "0.2.14"


+ 9
- 9
binaries/cli/src/template/c/dataflow-template.yml View File

@@ -3,25 +3,25 @@ communication:
prefix: /___name___

nodes:
- id: runtime-node-1
- id: runtime-node_1
operators:
- id: op-1
shared-library: build/op-1
- id: op_1
shared-library: build/op_1
inputs:
tick: dora/timer/millis/100
outputs:
- some-output
- id: op-2
shared-library: build/op-2
- id: op_2
shared-library: build/op_2
inputs:
tick: dora/timer/secs/2
outputs:
- some-output

- id: custom-node-1
- id: custom-node_1
custom:
source: build/node-1
source: build/node_1
inputs:
tick: dora/timer/secs/1
input-1: op-1/some-output
input-2: op-2/some-output
input-1: op_1/some-output
input-2: op_2/some-output

+ 6
- 3
binaries/cli/src/template/c/mod.rs View File

@@ -39,9 +39,9 @@ fn create_dataflow(name: String, path: Option<PathBuf>) -> Result<(), eyre::ErrR
fs::write(&dataflow_yml_path, &dataflow_yml)
.with_context(|| format!("failed to write `{}`", dataflow_yml_path.display()))?;

create_operator("op-1".into(), Some(root.join("op-1")))?;
create_operator("op-2".into(), Some(root.join("op-2")))?;
create_custom_node("node-1".into(), Some(root.join("node-1")))?;
create_operator("op_1".into(), Some(root.join("op_1")))?;
create_operator("op_2".into(), Some(root.join("op_2")))?;
create_custom_node("node_1".into(), Some(root.join("node_1")))?;

println!(
"Created new C dataflow at `{name}` at {}",
@@ -58,6 +58,9 @@ fn create_operator(name: String, path: Option<PathBuf>) -> Result<(), eyre::ErrR
if name.contains('/') {
bail!("operator name must not contain `/` separators");
}
if name.contains('-') {
bail!("operator name must not contain `-` separators");
}
if !name.is_ascii() {
bail!("operator name must be ASCII");
}


+ 1
- 1
binaries/cli/src/template/rust/Cargo-template.toml View File

@@ -1,2 +1,2 @@
[workspace]
members = ["op-1", "op-2", "node-1"]
members = ["op_1", "op_2", "node_1"]

+ 12
- 12
binaries/cli/src/template/rust/dataflow-template.yml View File

@@ -3,28 +3,28 @@ communication:
prefix: /___name___

nodes:
- id: runtime-node-1
- id: runtime-node_1
operators:
- id: op-1
build: cargo build -p op-1
shared-library: target/debug/op-1
- id: op_1
build: cargo build -p op_1
shared-library: target/debug/op_1
inputs:
tick: dora/timer/millis/100
outputs:
- some-output
- id: op-2
build: cargo build -p op-2
shared-library: target/debug/op-2
- id: op_2
build: cargo build -p op_2
shared-library: target/debug/op_2
inputs:
tick: dora/timer/secs/2
outputs:
- some-output

- id: custom-node-1
- id: custom-node_1
custom:
build: cargo build -p node-1
source: target/debug/node-1
build: cargo build -p node_1
source: target/debug/node_1
inputs:
tick: dora/timer/secs/1
input-1: op-1/some-output
input-2: op-2/some-output
input-1: op_1/some-output
input-2: op_2/some-output

+ 9
- 3
binaries/cli/src/template/rust/mod.rs View File

@@ -44,9 +44,9 @@ fn create_dataflow(name: String, path: Option<PathBuf>) -> Result<(), eyre::ErrR
fs::write(&cargo_toml_path, &cargo_toml)
.with_context(|| format!("failed to write `{}`", cargo_toml_path.display()))?;

create_operator("op-1".into(), Some(root.join("op-1")))?;
create_operator("op-2".into(), Some(root.join("op-2")))?;
create_custom_node("node-1".into(), Some(root.join("node-1")))?;
create_operator("op_1".into(), Some(root.join("op_1")))?;
create_operator("op_2".into(), Some(root.join("op_2")))?;
create_custom_node("node_1".into(), Some(root.join("node_1")))?;

println!(
"Created new Rust dataflow at `{name}` at {}",
@@ -63,6 +63,12 @@ fn create_operator(name: String, path: Option<PathBuf>) -> Result<(), eyre::ErrR
if name.contains('/') {
bail!("operator name must not contain `/` separators");
}
if name.contains('-') {
bail!(
"operator name must not contain `-` separators as
it get replaced by `_` as a static library."
);
}
if !name.is_ascii() {
bail!("operator name must be ASCII");
}


+ 1
- 1
binaries/cli/src/template/rust/node/Cargo-template.toml View File

@@ -6,4 +6,4 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
dora-node-api = "0.1.0"
dora-node-api = { git = "https://github.com/dora-rs/dora.git" }

+ 2
- 2
binaries/cli/src/template/rust/node/main-template.rs View File

@@ -1,4 +1,4 @@
use dora_node_api::{self, config::DataId, DoraNode};
use dora_node_api::{self, core::config::DataId, DoraNode};
use std::error::Error;

fn main() -> Result<(), Box<dyn Error>> {
@@ -7,7 +7,7 @@ fn main() -> Result<(), Box<dyn Error>> {

while let Ok(input) = inputs.recv() {
match input.id.as_str() {
other => eprintln!("Ignoring unexpected input `{other}`"),
other => eprintln!("Received input `{other}`"),
}
}



+ 1
- 1
binaries/cli/src/template/rust/operator/Cargo-template.toml View File

@@ -9,4 +9,4 @@ edition = "2021"
crate-type = ["cdylib"]

[dependencies]
dora-operator-api = "0.1.0"
dora-operator-api = { git = "https://github.com/dora-rs/dora.git" }

+ 1
- 2
binaries/cli/src/template/rust/operator/lib-template.rs View File

@@ -1,5 +1,4 @@
use dora_operator_api::{register_operator, DoraOperator, DoraOutputSender, DoraStatus};
use std::time::{Duration, Instant};

register_operator!(ExampleOperator);

@@ -16,7 +15,7 @@ impl DoraOperator for ExampleOperator {
output_sender: &mut DoraOutputSender,
) -> Result<DoraStatus, String> {
match id {
other => eprintln!("ignoring unexpected input {other}"),
other => eprintln!("Received input {other}"),
}
Ok(DoraStatus::Continue)
}


+ 2
- 1
binaries/coordinator/Cargo.toml View File

@@ -25,6 +25,7 @@ dora-message = { path = "../../libraries/message" }
tracing = "0.1.36"
tracing-subscriber = "0.3.15"
futures-concurrency = "5.0.1"
zenoh = { git = "https://github.com/eclipse-zenoh/zenoh.git" }
zenoh = { git = "https://github.com/eclipse-zenoh/zenoh.git", rev = "79a136e4fd90b11ff5d775ced981af53c4f1071b" }
serde_json = "1.0.86"
dora-download = { path = "../../libraries/extensions/download" }
which = "4.3.0"

+ 1
- 1
binaries/coordinator/src/run/mod.rs View File

@@ -45,7 +45,7 @@ pub async fn spawn_dataflow(runtime: &Path, dataflow_path: &Path) -> eyre::Resul
.iter()
.any(|n| matches!(n.kind, CoreNodeKind::Runtime(_)))
{
match runtime.canonicalize() {
match which::which(runtime.as_os_str()) {
Ok(path) => {
runtime = path;
}


+ 2
- 2
binaries/runtime/Cargo.toml View File

@@ -29,8 +29,8 @@ libloading = "0.7.3"
serde_yaml = "0.8.23"
tokio = { version = "1.17.0", features = ["full"] }
tokio-stream = "0.1.8"
zenoh = { git = "https://github.com/eclipse-zenoh/zenoh.git" }
zenoh-config = { git = "https://github.com/eclipse-zenoh/zenoh.git" }
zenoh = { git = "https://github.com/eclipse-zenoh/zenoh.git", rev = "79a136e4fd90b11ff5d775ced981af53c4f1071b" }
zenoh-config = { git = "https://github.com/eclipse-zenoh/zenoh.git", rev = "79a136e4fd90b11ff5d775ced981af53c4f1071b" }
fern = "0.6.1"
pyo3 = { version = "0.16.5", features = ["auto-initialize", "eyre"] }
flume = "0.10.14"


+ 2
- 2
libraries/communication-layer/Cargo.toml View File

@@ -10,8 +10,8 @@ iceoryx = ["dep:iceoryx-rs", "dep:iceoryx-sys"]

[dependencies]
eyre = "0.6.8"
zenoh = { git = "https://github.com/eclipse-zenoh/zenoh.git", optional = true }
zenoh-config = { git = "https://github.com/eclipse-zenoh/zenoh.git", optional = true }
zenoh = { git = "https://github.com/eclipse-zenoh/zenoh.git", rev = "79a136e4fd90b11ff5d775ced981af53c4f1071b", optional = true }
zenoh-config = { git = "https://github.com/eclipse-zenoh/zenoh.git", rev = "79a136e4fd90b11ff5d775ced981af53c4f1071b", optional = true }

[target.'cfg(unix)'.dependencies]
iceoryx-rs = { git = "https://github.com/eclipse-iceoryx/iceoryx-rs.git", optional = true }


+ 1
- 1
libraries/core/Cargo.toml View File

@@ -11,4 +11,4 @@ eyre = "0.6.8"
serde = { version = "1.0.136", features = ["derive"] }
serde_yaml = "0.9.11"
once_cell = "1.13.0"
zenoh-config = { git = "https://github.com/eclipse-zenoh/zenoh.git" }
zenoh-config = { git = "https://github.com/eclipse-zenoh/zenoh.git", rev = "79a136e4fd90b11ff5d775ced981af53c4f1071b" }

+ 2
- 2
libraries/extensions/zenoh-logger/Cargo.toml View File

@@ -7,5 +7,5 @@ license = "Apache-2.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
zenoh = { git = "https://github.com/eclipse-zenoh/zenoh.git" }
zenoh-config = { git = "https://github.com/eclipse-zenoh/zenoh.git" }
zenoh = { git = "https://github.com/eclipse-zenoh/zenoh.git", rev = "79a136e4fd90b11ff5d775ced981af53c4f1071b" }
zenoh-config = { git = "https://github.com/eclipse-zenoh/zenoh.git", rev = "79a136e4fd90b11ff5d775ced981af53c4f1071b" }

Loading…
Cancel
Save