From 3d0deefde70b9dbc340ce8b77489dae6d2adece9 Mon Sep 17 00:00:00 2001 From: Claudio Cicconetti Date: Mon, 11 Sep 2023 10:23:42 +0200 Subject: [PATCH] Simple workflow: use better callback names --- examples/simple_workflow_http/README.md | 5 +---- examples/simple_workflow_http/double/function.json | 2 +- examples/simple_workflow_http/double/src/lib.rs | 2 +- .../http_read_number/function.json | 2 +- .../simple_workflow_http/http_read_number/src/lib.rs | 2 +- examples/simple_workflow_http/incr/function.json | 2 +- examples/simple_workflow_http/incr/src/lib.rs | 2 +- examples/simple_workflow_http/workflow.json | 12 ++++++------ 8 files changed, 13 insertions(+), 16 deletions(-) diff --git a/examples/simple_workflow_http/README.md b/examples/simple_workflow_http/README.md index dd93447b..f4bbc850 100644 --- a/examples/simple_workflow_http/README.md +++ b/examples/simple_workflow_http/README.md @@ -14,15 +14,12 @@ target/debug/edgeless_cli function build examples/simple_workflow_http/double/fu target/debug/edgeless_cli function build examples/simple_workflow_http/incr/function.json ``` - Then, you can request the controller to start the workflow: ```bash -ID=$(target/debug/edgeless_cli workflow start examples/simple_workflow_http/workflow.json) +target/debug/edgeless_cli workflow start examples/simple_workflow_http/workflow.json ``` -Now `$ID` contains the workflow identifier assigned by the controller. - In a shell open a TCP socket at port 10000 that plays the role of the external sink: ```bash diff --git a/examples/simple_workflow_http/double/function.json b/examples/simple_workflow_http/double/function.json index e757ccfe..2e635c46 100644 --- a/examples/simple_workflow_http/double/function.json +++ b/examples/simple_workflow_http/double/function.json @@ -4,6 +4,6 @@ "version": "0.1", "build": "Cargo.toml", "output_callbacks": [ - "cb_success" + "result" ] } \ No newline at end of file diff --git a/examples/simple_workflow_http/double/src/lib.rs b/examples/simple_workflow_http/double/src/lib.rs index 6ca8d7c7..771fda73 100644 --- a/examples/simple_workflow_http/double/src/lib.rs +++ b/examples/simple_workflow_http/double/src/lib.rs @@ -7,7 +7,7 @@ impl Edgefunction for DoubleFun { log::info!("double: called with '{}'", encoded_message); if let Ok(n) = encoded_message.parse::() { - cast_alias("cb_success", format!("{}", 2 * n).as_str()); + cast_alias("result", format!("{}", 2 * n).as_str()); } } diff --git a/examples/simple_workflow_http/http_read_number/function.json b/examples/simple_workflow_http/http_read_number/function.json index d203284a..cc60f86c 100644 --- a/examples/simple_workflow_http/http_read_number/function.json +++ b/examples/simple_workflow_http/http_read_number/function.json @@ -4,6 +4,6 @@ "version": "0.1", "build": "Cargo.toml", "output_callbacks": [ - "cb_success" + "parsed_value" ] } \ No newline at end of file diff --git a/examples/simple_workflow_http/http_read_number/src/lib.rs b/examples/simple_workflow_http/http_read_number/src/lib.rs index 96d1e6e8..61eb9700 100644 --- a/examples/simple_workflow_http/http_read_number/src/lib.rs +++ b/examples/simple_workflow_http/http_read_number/src/lib.rs @@ -14,7 +14,7 @@ impl Edgefunction for HttpReadNumberFun { if let Some(body) = req.body { if let Ok(content) = String::from_utf8(body) { if let Ok(_) = content.parse::() { - cast_alias("cb_success", &content); + cast_alias("parsed_value", &content); (200, None) } else { (400, Some(Vec::::from("body does not contain an integer"))) diff --git a/examples/simple_workflow_http/incr/function.json b/examples/simple_workflow_http/incr/function.json index ff5db725..78a4467b 100644 --- a/examples/simple_workflow_http/incr/function.json +++ b/examples/simple_workflow_http/incr/function.json @@ -4,6 +4,6 @@ "version": "0.1", "build": "Cargo.toml", "output_callbacks": [ - "cb_success" + "result" ] } \ No newline at end of file diff --git a/examples/simple_workflow_http/incr/src/lib.rs b/examples/simple_workflow_http/incr/src/lib.rs index 6bd27a71..de4f1ef2 100644 --- a/examples/simple_workflow_http/incr/src/lib.rs +++ b/examples/simple_workflow_http/incr/src/lib.rs @@ -7,7 +7,7 @@ impl Edgefunction for IncrFun { log::info!("incr: called with '{}'", encoded_message); if let Ok(n) = encoded_message.parse::() { - cast_alias("cb_success", format!("{}", n + 1).as_str()); + cast_alias("result", format!("{}", n + 1).as_str()); } } diff --git a/examples/simple_workflow_http/workflow.json b/examples/simple_workflow_http/workflow.json index 3655b968..563b2c6c 100644 --- a/examples/simple_workflow_http/workflow.json +++ b/examples/simple_workflow_http/workflow.json @@ -9,11 +9,11 @@ "version": "0.1", "include_code_file": "./http_read_number/http_read_number.wasm", "output_callbacks": [ - "cb_success" + "parsed_value" ] }, "output_callback_definitions": { - "cb_success": "incr" + "parsed_value": "incr" }, "annotations": {} }, @@ -25,11 +25,11 @@ "version": "0.1", "include_code_file": "./incr/incr.wasm", "output_callbacks": [ - "cb_success" + "result" ] }, "output_callback_definitions": { - "cb_success": "double" + "result": "double" }, "annotations": {} }, @@ -41,11 +41,11 @@ "version": "0.1", "include_code_file": "./double/double.wasm", "output_callbacks": [ - "cb_success" + "result" ] }, "output_callback_definitions": { - "cb_success": "external_sink" + "result": "external_sink" }, "annotations": {} },