Skip to content

Commit c31c068

Browse files
committed
Naming fix: Pipeline -> Flow
Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
1 parent 6c15dfa commit c31c068

34 files changed

+187
-210
lines changed

crates/core/tedge/src/cli/mapping/cli.rs

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,37 @@ use anyhow::Context;
88
use anyhow::Error;
99
use std::path::PathBuf;
1010
use tedge_config::TEdgeConfig;
11-
use tedge_gen_mapper::pipeline::Message;
11+
use tedge_gen_mapper::flow::Message;
1212
use tedge_gen_mapper::MessageProcessor;
1313

1414
#[derive(clap::Subcommand, Debug)]
1515
pub enum TEdgeMappingCli {
16-
/// List pipelines and filters
16+
/// List flows and filters
1717
List {
18-
/// Path to pipeline and filter specs
18+
/// Path to flow and filter specs
1919
///
2020
/// Default to /etc/tedge/gen-mapper
2121
#[clap(long)]
2222
mapping_dir: Option<PathBuf>,
2323

24-
/// List pipelines processing messages published on this topic
24+
/// List flows processing messages published on this topic
2525
///
26-
/// If none is provided, lists all the pipelines
26+
/// If none is provided, lists all the flows
2727
#[clap(long)]
2828
topic: Option<String>,
2929
},
3030

3131
/// Process message samples
3232
Test {
33-
/// Path to pipeline and filter specs
33+
/// Path to flow and filter specs
3434
///
3535
/// Default to /etc/tedge/gen-mapper
3636
#[clap(long)]
3737
mapping_dir: Option<PathBuf>,
3838

39-
/// Path to the javascript filter or TOML pipeline definition
39+
/// Path to the javascript filter or TOML flow definition
4040
///
41-
/// If none is provided, applies all the matching pipelines
41+
/// If none is provided, applies all the matching flows
4242
#[clap(long)]
4343
filter: Option<PathBuf>,
4444

@@ -98,25 +98,20 @@ impl TEdgeMappingCli {
9898
config.root_dir().join("gen-mapper").into()
9999
}
100100

101-
pub async fn load_pipelines(mapping_dir: &PathBuf) -> Result<MessageProcessor, Error> {
101+
pub async fn load_flows(mapping_dir: &PathBuf) -> Result<MessageProcessor, Error> {
102102
MessageProcessor::try_new(mapping_dir)
103103
.await
104-
.with_context(|| {
105-
format!(
106-
"loading pipelines and filters from {}",
107-
mapping_dir.display()
108-
)
109-
})
104+
.with_context(|| format!("loading flows and filters from {}", mapping_dir.display()))
110105
}
111106

112107
pub async fn load_filter(
113108
mapping_dir: &PathBuf,
114109
path: &PathBuf,
115110
) -> Result<MessageProcessor, Error> {
116111
if let Some("toml") = path.extension().and_then(|s| s.to_str()) {
117-
MessageProcessor::try_new_single_pipeline(mapping_dir, path)
112+
MessageProcessor::try_new_single_flow(mapping_dir, path)
118113
.await
119-
.with_context(|| format!("loading pipeline {pipeline}", pipeline = path.display()))
114+
.with_context(|| format!("loading flow {flow}", flow = path.display()))
120115
} else {
121116
MessageProcessor::try_new_single_filter(mapping_dir, path)
122117
.await

crates/core/tedge/src/cli/mapping/list.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::log::MaybeFancy;
44
use anyhow::Error;
55
use std::path::PathBuf;
66
use tedge_config::TEdgeConfig;
7-
use tedge_gen_mapper::pipeline::Pipeline;
7+
use tedge_gen_mapper::flow::Flow;
88

99
pub struct ListCommand {
1010
pub mapping_dir: PathBuf,
@@ -14,33 +14,30 @@ pub struct ListCommand {
1414
#[async_trait::async_trait]
1515
impl Command for ListCommand {
1616
fn description(&self) -> String {
17-
format!(
18-
"list pipelines and filters in {:}",
19-
self.mapping_dir.display()
20-
)
17+
format!("list flows and filters in {:}", self.mapping_dir.display())
2118
}
2219

2320
async fn execute(&self, _config: TEdgeConfig) -> Result<(), MaybeFancy<Error>> {
24-
let processor = TEdgeMappingCli::load_pipelines(&self.mapping_dir).await?;
21+
let processor = TEdgeMappingCli::load_flows(&self.mapping_dir).await?;
2522

2623
match &self.topic {
2724
Some(topic) => processor
28-
.pipelines
25+
.flows
2926
.iter()
30-
.filter(|(_, pipeline)| pipeline.topics().accept_topic_name(topic))
27+
.filter(|(_, flow)| flow.topics().accept_topic_name(topic))
3128
.for_each(Self::display),
3229

33-
None => processor.pipelines.iter().for_each(Self::display),
30+
None => processor.flows.iter().for_each(Self::display),
3431
}
3532

3633
Ok(())
3734
}
3835
}
3936

4037
impl ListCommand {
41-
fn display((pipeline_id, pipeline): (&String, &Pipeline)) {
42-
println!("{pipeline_id}");
43-
for stage in pipeline.stages.iter() {
38+
fn display((flow_id, flow): (&String, &Flow)) {
39+
println!("{flow_id}");
40+
for stage in flow.stages.iter() {
4441
println!("\t{}", stage.filter.path.display());
4542
}
4643
}

crates/core/tedge/src/cli/mapping/test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::log::MaybeFancy;
44
use anyhow::Error;
55
use std::path::PathBuf;
66
use tedge_config::TEdgeConfig;
7-
use tedge_gen_mapper::pipeline::*;
7+
use tedge_gen_mapper::flow::*;
88
use tedge_gen_mapper::MessageProcessor;
99
use tokio::io::AsyncBufReadExt;
1010
use tokio::io::BufReader;
@@ -21,14 +21,14 @@ pub struct TestCommand {
2121
impl Command for TestCommand {
2222
fn description(&self) -> String {
2323
format!(
24-
"process message samples using pipelines and filters in {:}",
24+
"process message samples using flows and filters in {:}",
2525
self.mapping_dir.display()
2626
)
2727
}
2828

2929
async fn execute(&self, _config: TEdgeConfig) -> Result<(), MaybeFancy<Error>> {
3030
let mut processor = match &self.filter {
31-
None => TEdgeMappingCli::load_pipelines(&self.mapping_dir).await?,
31+
None => TEdgeMappingCli::load_flows(&self.mapping_dir).await?,
3232
Some(filter) => TEdgeMappingCli::load_filter(&self.mapping_dir, filter).await?,
3333
};
3434
if let Some(message) = &self.message {

0 commit comments

Comments
 (0)