You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by dg...@apache.org on 2018/12/07 01:25:59 UTC
[incubator-openwhisk-composer] branch master updated: Rename
$resume parameter to $composer (#15)
This is an automated email from the ASF dual-hosted git repository.
dgrove pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-composer.git
The following commit(s) were added to refs/heads/master by this push:
new 4756e16 Rename $resume parameter to $composer (#15)
4756e16 is described below
commit 4756e16d9d5bbb3bf68e599a2c5bf8d2061dd149
Author: Olivier Tardieu <ta...@users.noreply.github.com>
AuthorDate: Thu Dec 6 20:25:55 2018 -0500
Rename $resume parameter to $composer (#15)
---
conductor.js | 14 +++++++-------
docs/COMPOSITIONS.md | 6 ++++++
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/conductor.js b/conductor.js
index a70f5a7..aca9fb1 100644
--- a/conductor.js
+++ b/conductor.js
@@ -182,7 +182,7 @@ function main (composition) {
},
action ({ p, node, index }) {
- return { method: 'action', action: node.name, params: p.params, state: { $resume: p.s } }
+ return { method: 'action', action: node.name, params: p.params, state: { $composer: p.s } }
},
function ({ p, node, index }) {
@@ -208,7 +208,7 @@ function main (composition) {
},
async ({ p, node, index, inspect, step }) {
- p.params.$resume = { state: p.s.state, stack: [{ marker: true }].concat(p.s.stack) }
+ p.params.$composer = { state: p.s.state, stack: [{ marker: true }].concat(p.s.stack) }
p.s.state = index + node.return
if (!wsk) wsk = openwhisk({ ignore_certs: true })
return wsk.actions.invoke({ name: process.env.__OW_ACTION_NAME, params: p.params })
@@ -303,19 +303,19 @@ function main (composition) {
// do invocation
return (params) => {
// extract parameters
- const $resume = params.$resume || {}
- delete params.$resume
- $resume.session = $resume.session || process.env.__OW_ACTIVATION_ID
+ const $composer = params.$composer || {}
+ delete params.$composer
+ $composer.session = $composer.session || process.env.__OW_ACTIVATION_ID
// current state
- const p = { s: Object.assign({ state: 0, stack: [], resuming: true }, $resume), params }
+ const p = { s: Object.assign({ state: 0, stack: [], resuming: true }, $composer), params }
// step and catch all errors
return Promise.resolve().then(() => {
if (typeof p.s.state !== 'number') return internalError('state parameter is not a number')
if (!Array.isArray(p.s.stack)) return internalError('stack parameter is not an array')
- if ($resume.resuming) inspect(p) // handle error objects when resuming
+ if ($composer.resuming) inspect(p) // handle error objects when resuming
return step(p)
}).catch(error => {
diff --git a/docs/COMPOSITIONS.md b/docs/COMPOSITIONS.md
index 8a19717..045d248 100644
--- a/docs/COMPOSITIONS.md
+++ b/docs/COMPOSITIONS.md
@@ -58,6 +58,12 @@ the sequence is not executed. Moreover, if the sequence is enclosed in an error
handling composition like a `composer.try(sequence, handler)` combinator, the
execution continues with the error handler.
+### Reserved parameter name
+
+The field name `$composer` is reserved for composer internal use. Compositions
+and composed actions should not expect or return parameter objects with a
+top-level field named `$composer`.
+
## Data flow
The invocation of a composition triggers a series of computations (possibly