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
Note - Alpha, work-in-progress, names and other details are in flux
5
5
6
6
A library for building concurrent, event driven data processing
@@ -74,20 +74,27 @@
74
74
input or output of the process, returning a future that will
75
75
complete when done.</pre></div></div><divclass="public anchor" id="var-lift*-.3Estep"><h3>lift*->step</h3><divclass="usage"><code>(lift*->step f)</code></div><divclass="doc"><preclass="plaintext">given a fn f taking one arg and returning a collection of non-nil
76
76
values, create a 'step' fn as needed by step-process, with one input
77
-
and one output (named :in and :out), and no state.</pre></div></div><divclass="public anchor" id="var-lift1-.3Estep"><h3>lift1->step</h3><divclass="usage"><code>(lift1->step f)</code></div><divclass="doc"><preclass="plaintext">like lift*->step except taking a fn returning one value, which, when
78
-
nil, will yield no output.</pre></div></div><divclass="public anchor" id="var-pause"><h3>pause</h3><divclass="usage"><code>(pause g)</code></div><divclass="doc"><preclass="plaintext">pauses a running flow
77
+
and one output (named :in and :out), and no state.</pre></div></div><divclass="public anchor" id="var-lift1-.3Estep"><h3>lift1->step</h3><divclass="usage"><code>(lift1->step f)</code></div><divclass="doc"><preclass="plaintext">like lift*->step except taking a fn returning one value, which when
78
+
nil will yield no output.</pre></div></div><divclass="public anchor" id="var-pause"><h3>pause</h3><divclass="usage"><code>(pause g)</code></div><divclass="doc"><preclass="plaintext">pauses a running flow
79
79
</pre></div></div><divclass="public anchor" id="var-pause-proc"><h3>pause-proc</h3><divclass="usage"><code>(pause-proc g pid)</code></div><divclass="doc"><preclass="plaintext">pauses a process
80
-
</pre></div></div><divclass="public anchor" id="var-ping"><h3>ping</h3><divclass="usage"><code>(ping g)</code></div><divclass="doc"><preclass="plaintext">pings all processes, which will put their status and state on the
81
-
report channel returned from start</pre></div></div><divclass="public anchor" id="var-ping-proc"><h3>ping-proc</h3><divclass="usage"><code>(ping-proc g pid)</code></div><divclass="doc"><preclass="plaintext">pings the process, which will put its status and state on the report
82
-
channel returned from start</pre></div></div><divclass="public anchor" id="var-process"><h3>process</h3><divclass="usage"><code>(process process-impl-map)</code><code>(process process-impl-map {:keys [workload timeout-ms], :or {timeout-ms 5000}, :as opts})</code></div><divclass="doc"><preclass="plaintext">Given a map of functions (described below), returns a launcher that
80
+
</pre></div></div><divclass="public anchor" id="var-ping"><h3>ping</h3><divclass="usage"><code>(ping g & {:keys [timeout-ms], :or {timeout-ms 1000}})</code></div><divclass="doc"><preclass="plaintext">pings all processes, returning a map of pid -> proc status and
81
+
state, for those procs that reply within timeout-ms (default 1000)</pre></div></div><divclass="public anchor" id="var-ping-proc"><h3>ping-proc</h3><divclass="usage"><code>(ping-proc g pid & {:keys [timeout-ms], :or {timeout-ms 1000}})</code></div><divclass="doc"><preclass="plaintext">like ping, but just pings the specified process
82
+
</pre></div></div><divclass="public anchor" id="var-process"><h3>process</h3><divclass="usage"><code>(process fn-or-map)</code><code>(process fn-or-map {:keys [workload timeout-ms], :or {timeout-ms 5000}, :as opts})</code></div><divclass="doc"><preclass="plaintext">Given a function of four arities (0-3), or a map of functions
83
+
corresponding thereto (described below), returns a launcher that
83
84
creates a process compliant with the process protocol (see the
84
-
spi/ProcLauncher doc). The possible entries for process-impl-map
85
-
are :describe, :init, :transition and :transform. This is
86
-
the core facility for defining the logic for processes via ordinary
87
-
functions.
88
-
89
-
:describe - required, () -> desc
90
-
where desc is a map with keys :params :ins and :outs, each of which
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.
95
+
96
+
arity 0, or :describe - required, () -> description
97
+
where description is a map with keys :params :ins and :outs, each of which
91
98
in turn is a map of keyword to doc string, and :workload with
92
99
possible values of :mixed :io :compute. All entries in the describe
93
100
return map are optional.
@@ -106,7 +113,7 @@
106
113
the proc. It will also be called by the impl in order to discover
107
114
what channels are needed.
108
115
109
-
:init - optional, (arg-map) -> initial-state
116
+
arity 1, or :init - optional, (arg-map) -> initial-state
110
117
111
118
init will be called once by the process to establish any initial
112
119
state. The arg-map will be a map of param->val, as supplied in the
@@ -127,7 +134,7 @@
127
134
will be part of the next channel read set. In the absence of this
The transform fn will be called every time a message arrives at any
@@ -184,19 +191,5 @@
184
191
exceptions thrown anywhere on any thread inside a flow will appear
185
192
in maps sent here. There will at least be a ::flow/ex entry with the
186
193
exception, and may be additional keys for pid, state, status etc
187
-
depending on the context of the error.</pre></div></div><divclass="public anchor" id="var-step-process"><h3>step-process</h3><divclass="usage"><code>(step-process f)</code><code>(step-process f opts)</code></div><divclass="doc"><preclass="plaintext">Given a (e.g. communication-free) step function f of three
188
-
arities (described below), and the same opts as 'process', returns a
189
-
launcher that creates a process compliant with the process
190
-
protocol (see 'process').
191
-
192
-
The arities of f are:
193
-
194
-
()->desc
195
-
a function matching the semantics of process' :describe
196
-
197
-
(arg-map)->initial-state
198
-
a function matching the semantics of process' :init
199
-
200
-
(state in-name msg)->[state' output]
201
-
a function matching the semantics of process' :transform</pre></div></div><divclass="public anchor" id="var-stop"><h3>stop</h3><divclass="usage"><code>(stop g)</code></div><divclass="doc"><preclass="plaintext">shuts down the flow, stopping all procsesses and closing the error
194
+
depending on the context of the error.</pre></div></div><divclass="public anchor" id="var-stop"><h3>stop</h3><divclass="usage"><code>(stop g)</code></div><divclass="doc"><preclass="plaintext">shuts down the flow, stopping all procsesses and closing the error
202
195
and report channels. The flow can be started again</pre></div></div></div></body></html>
Copy file name to clipboardExpand all lines: docs/clojure.core.async.html
+2-1
Original file line number
Diff line number
Diff line change
@@ -81,7 +81,8 @@
81
81
buffer must be specified. ex-handler must be a fn of one argument -
82
82
if an exception occurs during transformation it will be called with
83
83
the Throwable as an argument, and any non-nil return value will be
84
-
placed in the channel.</pre></div></div><divclass="public anchor" id="var-close.21"><h3>close!</h3><divclass="usage"><code>(close! chan)</code></div><divclass="doc"><preclass="plaintext">Closes a channel. The channel will no longer accept any puts (they
84
+
placed in the channel. Channels implement Datafiable; use datafy
85
+
to obtain the state of the channel and its buffer.</pre></div></div><divclass="public anchor" id="var-close.21"><h3>close!</h3><divclass="usage"><code>(close! chan)</code></div><divclass="doc"><preclass="plaintext">Closes a channel. The channel will no longer accept any puts (they
85
86
will be ignored). Data in the channel remains available for taking, until
86
87
exhausted, after which takes will return nil. If there are any
87
88
pending takes, they will be dispatched with nil. Closing a closed
0 commit comments