summaryrefslogtreecommitdiff
path: root/subplot.md
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers+gitlab@digital-scurf.org>2023-07-10 18:47:19 +0000
committerDaniel Silverstone <dsilvers+gitlab@digital-scurf.org>2023-07-10 18:47:19 +0000
commit38e985bb506235832d2de358fe93834139f2db30 (patch)
treef31d0ebaf92dd6540cd577e95b2f5c7e6432c92d /subplot.md
parent7a11efdf232d01ad5df1dab44514ed7481e5f346 (diff)
parent4a35ec5e00807e93408bd0e5cdc85e8e89db4904 (diff)
downloadsubplot-38e985bb506235832d2de358fe93834139f2db30.tar.gz
Merge branch 'liw/atomic-function' into 'main'
docs: make it clear that cleanups are call only on successful steps Closes #261 See merge request subplot/subplot!344
Diffstat (limited to 'subplot.md')
-rw-r--r--subplot.md18
1 files changed, 18 insertions, 0 deletions
diff --git a/subplot.md b/subplot.md
index fe60bb3..f2fee6d 100644
--- a/subplot.md
+++ b/subplot.md
@@ -687,6 +687,24 @@ implementation functions:
* A binding for a "then everything is OK" step, which captures nothing,
and calls the `check_everything_is_ok` function.
+## Step functions and cleanup
+
+A step function must be atomic: either it completes successfully, or
+it cleans up any changes it made before returning an indication of
+failure.
+
+A cleanup function is only called for successfully executed step
+functions.
+
+For example, consider a step that creates and starts a virtual
+machine. The step function creates the VM, then starts it, and if both
+actions succeeds, the step succeeds. A cleanup function for that step
+will stop and delete the VM. The cleanup is only called if the step
+succeeded. If the step function manages to create the VM, but not
+start it, it's the step function's responsibility to delete the VM,
+before it signals failure. The cleanup function won't be called in
+that case.
+
### Simple patterns
The simple patterns are of the form `{name}` and match a single word