Skip to content

Commit 8500143

Browse files
committed
Action doc commit
1 parent 716e7f1 commit 8500143

File tree

1 file changed

+17
-28
lines changed

1 file changed

+17
-28
lines changed

docs/clojure.core.async.flow.html

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
channel returned from start</pre></div></div><div class="public anchor" id="var-process"><h3>process</h3><div class="usage"><code>(process process-impl-map)</code><code>(process process-impl-map {:keys [workload timeout-ms], :or {timeout-ms 5000}, :as opts})</code></div><div class="doc"><pre class="plaintext">Given a map of functions (described below), returns a launcher that
8282
creates a process compliant with the process protocol (see the
8383
spi/ProcLauncher doc). The possible entries for process-impl-map
84-
are :describe, :init, :transition, :transform and :introduce. This is
84+
are :describe, :init, :transition and :transform. This is
8585
the core facility for defining the logic for processes via ordinary
8686
functions.
8787

@@ -107,9 +107,18 @@
107107

108108
:init - optional, (arg-map) -&gt; initial-state
109109

110-
init will be called once by the process to establish any
111-
initial state. The arg-map will be a map of param-&gt;val, as supplied
112-
in the flow def. init must be provided if 'describe' returns :params.
110+
init will be called once by the process to establish any initial
111+
state. The arg-map will be a map of param-&gt;val, as supplied in the
112+
flow def. init must be provided if 'describe' returns :params.
113+
114+
Optionally, a returned init state may contain the
115+
keys ::flow/in-ports and/or ::flow/out-ports. These should be maps
116+
of cid -&gt; a core.async.channel. The cids must not conflict with the
117+
in/out ids. These channels will become part of the read/write set of
118+
the process, but are not otherwise visible/resolvable within the
119+
flow. Ports are a way to have data enter or exit the flow from
120+
outside. Use :transition to coordinate the lifecycle of these
121+
external channels.
113122

114123
:transition - optional, (state transition) -&gt; state'
115124

@@ -121,9 +130,7 @@
121130
process will no longer be used following that. See the SPI for
122131
details. state' will be the state supplied to subsequent calls.
123132

124-
Exactly one of either :transform or :introduce are required.
125-
126-
:transform - (state in-name msg) -&gt; [state' output]
133+
:transform - required, (state in-name msg) -&gt; [state' output]
127134
where output is a map of outid-&gt;[msgs*]
128135

129136
The transform fn will be called every time a message arrives at any
@@ -134,21 +141,6 @@
134141
may never be nil (per core.async channels). state' will be the state
135142
supplied to subsequent calls.
136143

137-
:introduce - (state) -&gt; [state' output]
138-
where output is a map of outid-&gt;[msgs*], per :transform
139-
140-
The introduce fn is used for sources - proc-impls that introduce new data
141-
into the flow by doing I/O with something external to the flow and
142-
feeding that data to its outputs. A proc-impl specifying :introduce may not
143-
specify any :ins in its descriptor, as none but the ::flow/control channel
144-
will be read. Instead, introduce will be called every time through the
145-
process loop, and will presumably do blocking or paced I/O to get
146-
new data to return via its outputs. If it does blocking I/O it
147-
should do so with a timeout so it can regularly return to the
148-
process loop which can then look for control messages - it's fine
149-
for introduce to return with no output. Do not spin poll in the introduce
150-
fn.
151-
152144
process accepts an option map with keys:
153145
:workload - one of :mixed, :io or :compute
154146
:compute-timeout-ms - if :workload is :compute, this timeout (default 5000 msec)
@@ -158,14 +150,11 @@
158150
any :workload returned by the :describe fn of the process. If neither
159151
are provded the default is :mixed.
160152

161-
The :compute workload is not allowed for proc impls that
162-
provide :introduce (as I/O is presumed).
163-
164153
In the :workload context of :mixed or :io, this dictates the type of
165154
thread in which the process loop will run, _including its calls to
166-
transform/introduce_.
155+
transform_.
167156

168-
When :io is specified transform/introduce should not do extensive computation.
157+
When :io is specified, transform should not do extensive computation.
169158

170159
When :compute is specified (only allowed for :transform), each call
171160
to transform will be run in a separate thread. The process loop will
@@ -182,7 +171,7 @@
182171

183172
:report-chan - a core.async chan for reading.'ping' reponses
184173
will show up here, as will any explicit ::flow/report outputs
185-
from :transform/:introduce
174+
from :transform
186175

187176
:error-chan - a core.async chan for reading. Any (and only)
188177
exceptions thrown anywhere on any thread inside a flow will appear

0 commit comments

Comments
 (0)