You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The describe arity must return a static description of the step-fn's :params, :ins, and :outs. Each of these is a map of name (a keyword) to docstring.
18
18
@@ -26,17 +26,17 @@ For example, the describe arity might return this description for a simple step-
26
26
27
27
The names used for input and output channels should be distinct (no overlap).
28
28
29
-
### init: (step-fn arg-map) -> init-state
29
+
### init: `(step-fn arg-map) -> init-state`
30
30
31
31
The init arity is called once by the process to takes a set of args from the flow def (corresponding to the params returned from the describe arity) and returns the init state of the process.
32
32
33
-
### transition: (step-fn state transition) -> state'
33
+
### transition: `(step-fn state transition) -> state'`
34
34
35
35
The transition arity is called any time the flow or process undergoes a lifecycle transition (::flow/start, ::flow/stop, ::flow/pause, ::flow/resume). The description arity takes the current state and returns an updated state to be used for subsequent calls.
36
36
37
37
The step-fn should use the transition arity to coordinate the creation, pausing, and shutdown of external resources in a process.
38
38
39
-
### transform: (step-fn state input msg) -> [state' {out-id [msgs]}]
39
+
### transform: `(step-fn state input msg) -> [state' {out-id [msgs]}]`
40
40
41
41
The transform arity is called in a loop by the process for every message received on an input channel and returns a new state and a map of output cids to messages to return. The process will take care of sending these messages to the output channels. Output can be sent to none, any or all of the :outsenumerated, and/or an input named by a [pid inid] tuple (e.g. for reply-to), and/or to the ::flow/report output. A step need not output at all (output or msgs can be empyt/nil), however an output _message_ may never be nil (per core.async channels).
<p>You provide logic to flow in the form of <em>step-fns</em>, which are wrapped into running processes, executing in a loop. Flow manages the life cycle of the process and handles incoming and outgoing messages by putting or taking them on channels. Step-fns do not access channels directly or hold state, making them easy to test in isolation and reuse.</p>
<p>The describe arity must return a static description of the step-fn’s :params, :ins, and :outs. Each of these is a map of name (a keyword) to docstring.</p>
12
12
<p>For example, the describe arity might return this description for a simple step-fn:</p>
<p>The init arity is called once by the process to takes a set of args from the flow def (corresponding to the params returned from the describe arity) and returns the init state of the process.</p>
20
-
<h3><ahref="#transition-step-fn-state-transition-state" id="transition-step-fn-state-transition-state"></a>transition: (step-fn state transition) -> state’</h3>
20
+
<h3><ahref="#transition-step-fn-state-transition-state" id="transition-step-fn-state-transition-state"></a>transition: <code>(step-fn state transition) -> state'</code></h3>
21
21
<p>The transition arity is called any time the flow or process undergoes a lifecycle transition (::flow/start, ::flow/stop, ::flow/pause, ::flow/resume). The description arity takes the current state and returns an updated state to be used for subsequent calls.</p>
22
22
<p>The step-fn should use the transition arity to coordinate the creation, pausing, and shutdown of external resources in a process.</p>
23
-
<h3><ahref="#transform-step-fn-state-input-msg-state-out-id-msgs" id="transform-step-fn-state-input-msg-state-out-id-msgs"></a>transform: (step-fn state input msg) -> [state’ {out-id <ahref="msgs">msgs</a>}]</h3>
23
+
<h3><ahref="#transform-step-fn-state-input-msg-state-out-id-msgs" id="transform-step-fn-state-input-msg-state-out-id-msgs"></a>transform: <code>(step-fn state input msg) -> [state' {out-id [msgs]}]</code></h3>
24
24
<p>The transform arity is called in a loop by the process for every message received on an input channel and returns a new state and a map of output cids to messages to return. The process will take care of sending these messages to the output channels. Output can be sent to none, any or all of the :outsenumerated, and/or an input named by a <ahref="pid inid">pid inid</a> tuple (e.g. for reply-to), and/or to the ::flow/report output. A step need not output at all (output or msgs can be empyt/nil), however an output <em>message</em> may never be nil (per core.async channels).</p>
25
25
<p>The step-fn may throw excepitons from any arity and they will be handled by flow. Exceptions thrown from the transition or transform arities, the exception will be logged on the flow’s :error-chan.</p>
0 commit comments