Skip to content

Commit

Permalink
refacto: rename field name of descriptors to description
Browse files Browse the repository at this point in the history
This follows a discussion with @kogratte, as this field is in fact a
description.

Signed-off-by: Julien Loudet <julien.loudet@zettascale.tech>
  • Loading branch information
J-Loudet committed Oct 23, 2023
1 parent 0650de8 commit 3e5d3a9
Show file tree
Hide file tree
Showing 29 changed files with 94 additions and 111 deletions.
16 changes: 8 additions & 8 deletions zenoh-flow-descriptors/src/composite/operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ use zenoh_flow_commons::{Configuration, IMergeOverwrite, NodeId, Result};
/// use zenoh_flow_descriptors::CompositeOperatorDescriptor;
///
/// let yaml = "
/// name: CompositeOperator
/// description: CompositeOperator
///
/// configuration:
/// name: foo
///
/// operators:
/// - id: InnerOperator1
/// descriptor: file:///home/zenoh-flow/nodes/operator1.so
/// descriptor: file:///home/zenoh-flow/nodes/operator1.yaml
///
/// - id: InnerOperator2
/// descriptor: file:///home/zenoh-flow/nodes/operator2.so
/// descriptor: file:///home/zenoh-flow/nodes/operator2.yaml
///
/// links:
/// - from:
Expand All @@ -77,7 +77,7 @@ use zenoh_flow_commons::{Configuration, IMergeOverwrite, NodeId, Result};
///
/// let json = "
/// {
/// \"name\": \"CompositeOperator\",
/// \"description\": \"CompositeOperator\",
///
/// \"configuration\": {
/// \"name\": \"foo\"
Expand All @@ -86,11 +86,11 @@ use zenoh_flow_commons::{Configuration, IMergeOverwrite, NodeId, Result};
/// \"operators\": [
/// {
/// \"id\": \"InnerOperator1\",
/// \"descriptor\": \"file:///home/zenoh-flow/nodes/operator1.so\"
/// \"descriptor\": \"file:///home/zenoh-flow/nodes/operator1.yaml\"
/// },
/// {
/// \"id\": \"InnerOperator2\",
/// \"descriptor\": \"file:///home/zenoh-flow/nodes/operator2.so\"
/// \"descriptor\": \"file:///home/zenoh-flow/nodes/operator2.yaml\"
/// }
/// ],
///
Expand Down Expand Up @@ -130,7 +130,7 @@ use zenoh_flow_commons::{Configuration, IMergeOverwrite, NodeId, Result};
/// ```
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
pub struct CompositeOperatorDescriptor {
pub name: NodeId,
pub description: Arc<str>,
pub inputs: Vec<CompositeInputDescriptor>,
pub outputs: Vec<CompositeOutputDescriptor>,
pub operators: Vec<NodeDescriptor>,
Expand All @@ -141,7 +141,7 @@ pub struct CompositeOperatorDescriptor {

impl std::fmt::Display for CompositeOperatorDescriptor {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "Composite Operator: {}", self.name)
write!(f, "Composite Operator: {}", self.description)
}
}

Expand Down
16 changes: 8 additions & 8 deletions zenoh-flow-descriptors/src/composite/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const BASE_DIR: &str = "./tests/descriptors";
#[test]
fn test_flatten_composite_descriptor_non_nested() {
let composite_descriptor = CompositeOperatorDescriptor {
name: "composite-test".into(),
description: "composite-test".into(),
inputs: vec![
CompositeInputDescriptor::new("input-1", "my-operator-1", "operator-1-in-1"),
CompositeInputDescriptor::new("input-2", "my-operator-1", "operator-1-in-2"),
Expand Down Expand Up @@ -76,15 +76,15 @@ fn test_flatten_composite_descriptor_non_nested() {
let expected_operators = vec![
FlattenedOperatorDescriptor {
id: "composite/my-operator-1".into(),
name: "operator-1".into(),
description: "operator-1".into(),
inputs: vec!["operator-1-in-1".into(), "operator-1-in-2".into()],
outputs: vec!["operator-1-out".into()],
uri: Some("file://operator-1.so".into()),
configuration: Configuration::default(),
},
FlattenedOperatorDescriptor {
id: "composite/my-operator-2".into(),
name: "operator-2".into(),
description: "operator-2".into(),
inputs: vec!["operator-2-in".into()],
outputs: vec!["operator-2-out".into()],
uri: Some("file://operator-2.so".into()),
Expand Down Expand Up @@ -132,7 +132,7 @@ fn test_flatten_composite_descriptor_non_nested() {
#[test]
fn test_flatten_composite_descriptor_nested() {
let nested_composite_descriptor = CompositeOperatorDescriptor {
name: "nested-composite-test".into(),
description: "nested-composite-test".into(),
inputs: vec![CompositeInputDescriptor::new(
"composite-input",
"composite-outer-i",
Expand Down Expand Up @@ -188,31 +188,31 @@ fn test_flatten_composite_descriptor_nested() {
let expected_operators = vec![
FlattenedOperatorDescriptor {
id: "composite/composite-outer-o".into(),
name: "composite-outer".into(),
description: "composite-outer".into(),
inputs: vec!["composite-outer-in".into()],
outputs: vec!["composite-outer-out".into()],
uri: Some("file://composite-outer.so".into()),
configuration: Configuration::default(),
},
FlattenedOperatorDescriptor {
id: "composite/composite-nested/operator-1".into(),
name: "operator-1".into(),
description: "operator-1".into(),
inputs: vec!["operator-1-in-1".into(), "operator-1-in-2".into()],
outputs: vec!["operator-1-out".into()],
uri: Some("file://operator-1.so".into()),
configuration: Configuration::default(),
},
FlattenedOperatorDescriptor {
id: "composite/composite-nested/operator-2".into(),
name: "operator-2".into(),
description: "operator-2".into(),
inputs: vec!["operator-2-in".into()],
outputs: vec!["operator-2-out".into()],
uri: Some("file://operator-2.so".into()),
configuration: Configuration::default(),
},
FlattenedOperatorDescriptor {
id: "composite/composite-outer-i".into(),
name: "composite-outer".into(),
description: "composite-outer".into(),
inputs: vec!["composite-outer-in".into()],
outputs: vec!["composite-outer-out".into()],
uri: Some("file://composite-outer.so".into()),
Expand Down
12 changes: 6 additions & 6 deletions zenoh-flow-descriptors/src/flattened/dataflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use zenoh_flow_records::{DataFlowRecord, ZenohReceiver, ZenohSender};
///
/// sources:
/// - id: Source-0
/// name: Source
/// description: Source
/// configuration:
/// foo: bar
/// answer: 0
Expand All @@ -45,7 +45,7 @@ use zenoh_flow_records::{DataFlowRecord, ZenohReceiver, ZenohSender};
///
/// operators:
/// - id: Operator-1
/// name: Operator
/// description: Operator
/// configuration:
/// foo: bar
/// answer: 1
Expand All @@ -57,7 +57,7 @@ use zenoh_flow_records::{DataFlowRecord, ZenohReceiver, ZenohSender};
///
/// sinks:
/// - id: Sink-2
/// name: Sink
/// description: Sink
/// configuration:
/// foo: bar
/// answer: 2
Expand Down Expand Up @@ -94,7 +94,7 @@ use zenoh_flow_records::{DataFlowRecord, ZenohReceiver, ZenohSender};
/// \"sources\": [
/// {
/// \"id\": \"Source-0\",
/// \"name\": \"Source\",
/// \"description\": \"Source\",
/// \"configuration\": {
/// \"foo\": \"bar\",
/// \"answer\": 0
Expand All @@ -110,7 +110,7 @@ use zenoh_flow_records::{DataFlowRecord, ZenohReceiver, ZenohSender};
/// \"operators\": [
/// {
/// \"id\": \"Operator-1\",
/// \"name\": \"Operator\",
/// \"description\": \"Operator\",
/// \"configuration\": {
/// \"foo\": \"bar\",
/// \"answer\": 1
Expand All @@ -128,7 +128,7 @@ use zenoh_flow_records::{DataFlowRecord, ZenohReceiver, ZenohSender};
/// \"sinks\": [
/// {
/// \"id\": \"Sink-2\",
/// \"name\": \"Sink\",
/// \"description\": \"Sink\",
/// \"configuration\": {
/// \"foo\": \"bar\",
/// \"answer\": 2
Expand Down
27 changes: 9 additions & 18 deletions zenoh-flow-descriptors/src/flattened/nodes/operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use zenoh_flow_records::OperatorRecord;
///
/// let yaml = "
/// id: Operator-1
/// name: Operator
/// description: Operator
/// configuration:
/// foo: bar
/// answer: 1
Expand All @@ -42,7 +42,7 @@ use zenoh_flow_records::OperatorRecord;
/// let json = "
/// {
/// \"id\": \"Operator-1\",
/// \"name\": \"Operator\",
/// \"description\": \"Operator\",
/// \"configuration\": {
/// \"foo\": \"bar\",
/// \"answer\": 1
Expand All @@ -65,7 +65,7 @@ use zenoh_flow_records::OperatorRecord;
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
pub struct FlattenedOperatorDescriptor {
pub id: NodeId,
pub name: Arc<str>,
pub description: Arc<str>,
pub inputs: Vec<PortId>,
pub outputs: Vec<PortId>,
pub uri: Option<Arc<str>>,
Expand Down Expand Up @@ -94,22 +94,13 @@ impl FlattenedOperatorDescriptor {

impl From<FlattenedOperatorDescriptor> for OperatorRecord {
fn from(value: FlattenedOperatorDescriptor) -> Self {
let FlattenedOperatorDescriptor {
id,
name,
inputs,
outputs,
uri,
configuration,
} = value;

Self {
id,
name,
inputs,
outputs,
uri,
configuration,
id: value.id,
description: value.description,
inputs: value.inputs,
outputs: value.outputs,
uri: value.uri,
configuration: value.configuration,
}
}
}
8 changes: 4 additions & 4 deletions zenoh-flow-descriptors/src/flattened/nodes/sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use zenoh_flow_records::SinkRecord;
///
/// let sink_yaml = "
/// id: Sink-2
/// name: Sink
/// description: Sink
/// configuration:
/// foo: bar
/// answer: 2
Expand All @@ -40,7 +40,7 @@ use zenoh_flow_records::SinkRecord;
/// let sink_json = "
/// {
/// \"id\": \"Sink-2\",
/// \"name\": \"Sink\",
/// \"description\": \"Sink\",
/// \"configuration\": {
/// \"foo\": \"bar\",
/// \"answer\": 2
Expand All @@ -59,7 +59,7 @@ use zenoh_flow_records::SinkRecord;
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct FlattenedSinkDescriptor {
pub id: NodeId,
pub name: Arc<str>,
pub description: Arc<str>,
pub uri: Option<Arc<str>>,
pub inputs: Vec<PortId>,
#[serde(default)]
Expand All @@ -76,7 +76,7 @@ impl From<FlattenedSinkDescriptor> for SinkRecord {
fn from(value: FlattenedSinkDescriptor) -> Self {
Self {
id: value.id,
name: value.name,
description: value.description,
inputs: value.inputs,
uri: value.uri,
configuration: value.configuration,
Expand Down
8 changes: 4 additions & 4 deletions zenoh-flow-descriptors/src/flattened/nodes/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use zenoh_flow_records::SourceRecord;
///
/// let source_yaml = "
/// id: Source-0
/// name: Source
/// description: Source
/// configuration:
/// foo: bar
/// answer: 0
Expand All @@ -40,7 +40,7 @@ use zenoh_flow_records::SourceRecord;
/// let source_json = "
/// {
/// \"id\": \"Source-0\",
/// \"name\": \"Source\",
/// \"description\": \"Source\",
/// \"configuration\": {
/// \"foo\": \"bar\",
/// \"answer\": 0
Expand All @@ -60,7 +60,7 @@ use zenoh_flow_records::SourceRecord;
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct FlattenedSourceDescriptor {
pub id: NodeId,
pub name: Arc<str>,
pub description: Arc<str>,
pub uri: Option<Arc<str>>,
pub outputs: Vec<PortId>,
#[serde(default)]
Expand All @@ -77,7 +77,7 @@ impl From<FlattenedSourceDescriptor> for SourceRecord {
fn from(value: FlattenedSourceDescriptor) -> Self {
Self {
id: value.id,
name: value.name,
description: value.description,
outputs: value.outputs,
uri: value.uri,
configuration: value.configuration,
Expand Down
6 changes: 3 additions & 3 deletions zenoh-flow-descriptors/src/flattened/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ fn generate_default_runtime() -> RuntimeContext {
fn generate_flattened_data_flow_descriptor() -> FlattenedDataFlowDescriptor {
let source = FlattenedSourceDescriptor {
id: SOURCE_ID.into(),
name: "Source".into(),
description: "Source".into(),
uri: Some("file:///home/zenoh-flow/source.so".into()),
outputs: vec![SOURCE_OUTPUT.into()],
configuration: Configuration::default(),
};

let operator = FlattenedOperatorDescriptor {
id: OPERATOR_ID.into(),
name: "Operator".into(),
description: "Operator".into(),
inputs: vec![OPERATOR_INPUT.into()],
outputs: vec![OPERATOR_OUTPUT.into()],
uri: Some("file:///home/zenoh-flow/operator.so".into()),
Expand All @@ -66,7 +66,7 @@ fn generate_flattened_data_flow_descriptor() -> FlattenedDataFlowDescriptor {

let sink = FlattenedSinkDescriptor {
id: SINK_ID.into(),
name: "Sink".into(),
description: "Sink".into(),
inputs: vec![SINK_INPUT.into()],
uri: Some("file:///home/zenoh-flow/sink.so".into()),
configuration: Configuration::default(),
Expand Down
4 changes: 2 additions & 2 deletions zenoh-flow-descriptors/src/nodes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ use zenoh_flow_commons::{Configuration, NodeId, Result};
/// use zenoh_flow_descriptors::NodeDescriptor;
///
/// let yaml = "
/// id: NodeDescriptor
/// id: UniqueID
/// descriptor: file:///home/zenoh-flow/nodes/libnode.so
/// ";
///
/// let node_descriptor_yaml = serde_yaml::from_str::<NodeDescriptor>(&yaml).unwrap();
///
/// let json = "
/// {
/// \"id\": \"NodeDescriptor\",
/// \"id\": \"UniqueID\",
/// \"descriptor\": \"file:///home/zenoh-flow/nodes/libnode.so\"
/// }
/// ";
Expand Down
Loading

0 comments on commit 3e5d3a9

Please sign in to comment.