File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
src/main/clojure/clojure/core Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,8 @@ to catch and handle."
92
92
buffer must be specified. ex-handler must be a fn of one argument -
93
93
if an exception occurs during transformation it will be called with
94
94
the Throwable as an argument, and any non-nil return value will be
95
- placed in the channel."
95
+ placed in the channel. Channels implement Datafiable; use datafy
96
+ to obtain the state of the channel and its buffer."
96
97
([] (chan nil ))
97
98
([buf-or-n] (chan buf-or-n nil ))
98
99
([buf-or-n xform] (chan buf-or-n xform nil ))
Original file line number Diff line number Diff line change 303
303
(add! buf val)
304
304
(catch Throwable t
305
305
(handle buf exh t)))))))))
306
+
307
+ (extend-protocol clojure.core.protocols/Datafiable
308
+ ManyToManyChannel
309
+ (datafy [c]
310
+ (let [b (.buf c)]
311
+ {:buffer-type (if b
312
+ (-> b class .getSimpleName symbol)
313
+ :none )
314
+ :buffer-count (count b)
315
+ :put-count (count (.puts c))
316
+ :take-count (count (.takes c))
317
+ :closed? (impl/closed? c)})))
You can’t perform that action at this time.
0 commit comments