Skip to content

Commit f79bd00

Browse files
committed
docs: add alts and tapestry.queue to Readme
Update the documentation to the latest version.
1 parent d4c09e1 commit f79bd00

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

Readme.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ point it will likely hit 1.0.
5454
Add to your deps.edn:
5555

5656
```
57-
teknql/tapestry {:mvn/version "0.4.2"}
57+
teknql/tapestry {:git/url "https://github.com/teknql/tapestry"
58+
:git/sha "d4c09e1866ab9d4988f04fca83969043b4c857f8"}
5859
```
5960

6061
## Showcase
@@ -231,6 +232,47 @@ each fiber will have a timeout that starts from when the fiber was spawned.
231232
;; => 1
232233
```
233234

235+
## Experimental Features
236+
237+
Note that you must run your JVM with `--enable-preview` for the following
238+
239+
#### alts
240+
241+
``` clojure
242+
(require '[tapestry.experimental :refer [alts]])
243+
244+
;; Runs all expressions in parallel returning the first successful
245+
;; result. Will not forward errors from children expressions.
246+
(alts
247+
(do (Thread/sleep 100)
248+
:first)
249+
(do (Thread/sleep 10)
250+
:second))
251+
;; => :second after 10ms
252+
```
253+
254+
#### Queues
255+
256+
The beginnings of potentially dropping manifold support. Lightweight wrapper around java's
257+
BlockingQueues with the notion of `closing` ala `manifold` and `core.async`.
258+
259+
``` clojure
260+
(require '[tapestry.queue :as q]
261+
'[tapestry.core :refer [fiber alive?]]')
262+
263+
;; By default a queue has no buffer
264+
(let [q (q/queue)
265+
take* (fiber (q/take! q))]
266+
(alive? take*)
267+
(q/try-take! q) ;; => nil, no value available
268+
(q/put! q :value) ;; => true, value put successfuly
269+
@take* ;; => :value, resolved in the fiber above
270+
(q/close! q) ;; Closing a queue will make it so no further items are accepted,
271+
;; but previously queued items will be delivered via `take!`
272+
(q/put! q :value) ;; Returns false
273+
)
274+
```
275+
234276
## Advisories
235277

236278
None at the moment

0 commit comments

Comments
 (0)