Skip to content

Commit d922995

Browse files
committed
Action doc commit
1 parent 605ce02 commit d922995

File tree

3 files changed

+78
-25
lines changed

3 files changed

+78
-25
lines changed

docs/clojure.core.async.flow.html

+36-19
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
a set of channels for centralized control, reporting, error-handling,
1414
and execution of the processes
1515

16+
The flow library itself constructs processes, channels and flows. The
17+
user provides configuration data and process logic (step-fns) that
18+
specify how the flow should work.
19+
1620
A flow is constructed from flow configuration data which defines a
1721
directed graph of processes and the connections between
1822
them. Processes describe their I/O requirements and the
@@ -22,9 +26,9 @@
2226
policy decisions regarding process settings, threading, buffering etc.
2327

2428
It is expected that applications will rarely define instances of the
25-
process protocol but instead use the API functions here, 'process'
26-
and 'step-process', that implement the process protocol in terms of
27-
calls to ordinary functions that might include no communication or
29+
process protocol but instead use the API function 'process' that
30+
implements the process protocol in terms of calls to ordinary
31+
functions (step-fns) that might include no communication or
2832
core.async code. In this way the library helps you achieve a strict
2933
separation of your application logic from its execution,
3034
communication, lifecycle, error handling and monitoring.
@@ -36,6 +40,10 @@
3640
the library itself as ::flow/xyz, where ::flow is an alias for
3741
clojure.core.async.flow
3842

43+
Flows support the Clojure 'datafy' protocol to support
44+
observability. See also the 'ping' and 'ping-proc' fns for a live
45+
view of processes.
46+
3947
A process is represented in the flow definition by an implementation
4048
of spi/ProcLauncher that starts it. See the spi docs for
4149
details.</pre></div><div class="public anchor" id="var-command-proc"><h3>command-proc</h3><div class="usage"><code>(command-proc g pid cmd-id more-kvs)</code></div><div class="doc"><pre class="plaintext">synchronously sends a process-specific command with the given id and
@@ -73,25 +81,31 @@
7381
default :mixed</pre></div></div><div class="public anchor" id="var-inject"><h3>inject</h3><div class="usage"><code>(inject g [pid io-id :as coord] msgs)</code></div><div class="doc"><pre class="plaintext">asynchronously puts the messages on the channel corresponding to the
7482
input or output of the process, returning a future that will
7583
complete when done.</pre></div></div><div class="public anchor" id="var-lift*-.3Estep"><h3>lift*-&gt;step</h3><div class="usage"><code>(lift*-&gt;step f)</code></div><div class="doc"><pre class="plaintext">given a fn f taking one arg and returning a collection of non-nil
76-
values, create a 'step' fn as needed by step-process, with one input
84+
values, creates a step fn as needed by process, with one input
7785
and one output (named :in and :out), and no state.</pre></div></div><div class="public anchor" id="var-lift1-.3Estep"><h3>lift1-&gt;step</h3><div class="usage"><code>(lift1-&gt;step f)</code></div><div class="doc"><pre class="plaintext">like lift*-&gt;step except taking a fn returning one value, which when
7886
nil will yield no output.</pre></div></div><div class="public anchor" id="var-pause"><h3>pause</h3><div class="usage"><code>(pause g)</code></div><div class="doc"><pre class="plaintext">pauses a running flow
7987
</pre></div></div><div class="public anchor" id="var-pause-proc"><h3>pause-proc</h3><div class="usage"><code>(pause-proc g pid)</code></div><div class="doc"><pre class="plaintext">pauses a process
8088
</pre></div></div><div class="public anchor" id="var-ping"><h3>ping</h3><div class="usage"><code>(ping g &amp; {:keys [timeout-ms], :or {timeout-ms 1000}})</code></div><div class="doc"><pre class="plaintext">pings all processes, returning a map of pid -&gt; proc status and
8189
state, for those procs that reply within timeout-ms (default 1000)</pre></div></div><div class="public anchor" id="var-ping-proc"><h3>ping-proc</h3><div class="usage"><code>(ping-proc g pid &amp; {:keys [timeout-ms], :or {timeout-ms 1000}})</code></div><div class="doc"><pre class="plaintext">like ping, but just pings the specified process
82-
</pre></div></div><div class="public anchor" id="var-process"><h3>process</h3><div class="usage"><code>(process fn-or-map)</code><code>(process fn-or-map {:keys [workload timeout-ms], :or {timeout-ms 5000}, :as opts})</code></div><div class="doc"><pre class="plaintext">Given a function of four arities (0-3), or a map of functions
83-
corresponding thereto (described below), returns a launcher that
84-
creates a process compliant with the process protocol (see the
85-
spi/ProcLauncher doc).
86-
87-
The possible arities/entries for fn/map are 0 - :describe, 1
88-
- :init, 2 - :transition and 3 - :transform. This is the core
89-
facility for defining the logic for processes via ordinary
90-
functions. Using a var holding a fn as the 'fn' is the preferred
91-
method for defining a proc, as it enables hot-code-reloading of the
92-
proc logic in a flow, and better names in datafy. You can use the
93-
map form to compose the proc logic from disparate functions or to
94-
leverage the optionality of some of the entry points.
90+
</pre></div></div><div class="public anchor" id="var-process"><h3>process</h3><div class="usage"><code>(process fn-or-map)</code><code>(process fn-or-map {:keys [workload timeout-ms], :or {timeout-ms 5000}, :as opts})</code></div><div class="doc"><pre class="plaintext">Given a function of four arities (0-3), aka the 'step-fn', or a map
91+
of functions corresponding thereto (described below), returns a
92+
launcher that creates a process compliant with the process
93+
protocol (see the spi/ProcLauncher doc).
94+
95+
The possible arities/entries for the step-fn/map are
96+
97+
0 - :describe,
98+
1 - :init,
99+
2 - :transition
100+
3 - :transform.
101+
102+
This is the core facility for defining the logic for processes via
103+
ordinary functions. Using a var holding a fn as the 'step-fn' is the
104+
preferred method for defining a proc, as it enables
105+
hot-code-reloading of the proc logic in a flow, and better names in
106+
datafy. You can use the map form to compose the proc logic from
107+
disparate functions or to leverage the optionality of some of the
108+
entry points.
95109

96110
arity 0, or :describe - required, () -&gt; description
97111
where description is a map with keys :params :ins and :outs, each of which
@@ -117,7 +131,10 @@
117131

118132
init will be called once by the process to establish any initial
119133
state. The arg-map will be a map of param-&gt;val, as supplied in the
120-
flow def. init must be provided if 'describe' returns :params.
134+
flow def. The key ::flow/pid will be added, mapped to the pid
135+
associated with the process (useful e.g. if the process wants to
136+
refer to itself in reply-to coordinates). init must be provided if
137+
'describe' returns :params.
121138

122139
Optionally, a returned init state may contain the
123140
keys ::flow/in-ports and/or ::flow/out-ports. These should be maps
@@ -181,7 +198,7 @@
181198
When :compute is specified transform must not block!</pre></div></div><div class="public anchor" id="var-resume"><h3>resume</h3><div class="usage"><code>(resume g)</code></div><div class="doc"><pre class="plaintext">resumes a paused flow
182199
</pre></div></div><div class="public anchor" id="var-resume-proc"><h3>resume-proc</h3><div class="usage"><code>(resume-proc g pid)</code></div><div class="doc"><pre class="plaintext">resumes a process
183200
</pre></div></div><div class="public anchor" id="var-start"><h3>start</h3><div class="usage"><code>(start g)</code></div><div class="doc"><pre class="plaintext">starts the entire flow from init values. The processes start paused.
184-
Call 'resume' or 'resume-proc' to start flow. returns a map with keys:
201+
Call 'resume' or 'resume-proc' to start flow. Returns a map with keys:
185202

186203
:report-chan - a core.async chan for reading.'ping' reponses
187204
will show up here, as will any explicit ::flow/report outputs

0 commit comments

Comments
 (0)