Liking cljdoc? Tell your friends :D

qbits.auspex

This provides a clj friendly wrapper for CompletableFuture and adds a few utility functions to mimic manifold features. Shamelessly stole code/ideas from the awesome manifold library.

This provides a clj friendly wrapper for CompletableFuture and adds a
few utility functions to mimic manifold features.  Shamelessly stole
code/ideas from the awesome manifold library.
raw docstring

cancel!clj

source

canceled?clj

source

catchclj

source

chainclj

(chain x & fns)

Composes functions starting with x as argument triggering calls to fns for every step coercing the return values to deferreds if necessary and returns a deferred with the final result.

Composes functions starting with x as argument triggering calls to
fns for every step coercing the return values to deferreds if
necessary and returns a deferred with the final result.
sourceraw docstring

chain'clj

(chain' x & fns)

Like chain but assumes fns return raw values instead of potential futures

Like chain but assumes fns return raw values instead of potential
futures
sourceraw docstring

chain-futuresclj

(chain-futures x & fs)

Like chain but takes a value and functions that will return futures

Like chain but takes a value and functions that will return futures
sourceraw docstring

complete!clj

source

do->cljmacro

(do-> m-specs steps & body)

Utility macro to build monadic like constructs like let-flow

Utility macro to build monadic like constructs like `let-flow`
sourceraw docstring

error!clj

source

error-futureclj

(error-future x)

Returns a new CompletableFuture that is already completed exceptionally with the given exception.

Returns a new CompletableFuture that is already completed
exceptionally with the given exception.
sourceraw docstring

error?clj

source

finallyclj

source

fmapclj

source

futureclj

(future)
(future f)
(future f executor)

No arg creates an empty/incomplete future, 1 arg creates a future that will get the return value of f as realized value on fork-join common pool, 2 arg creates a future that will be realized on ExecutorService supplied with return value of f as realized value.

The executor that is set at this stage will continue to be used for subsequent steps (then/chain etc) if another one is not specified at another level

No arg creates an empty/incomplete future, 1 arg creates a future
that will get the return value of f as realized value on fork-join
common pool, 2 arg creates a future that will be realized on
ExecutorService supplied with return value of f as realized value.

The executor that is set at this stage will continue to be used for
subsequent steps (then/chain etc) if another one is not specified at
another level
sourceraw docstring

future-mclj

source

future?clj

(future? x)

Returns true if x is a CompletableFuture

Returns true if x is a CompletableFuture
sourceraw docstring

handleclj

source

let-flowcljmacro

(let-flow steps & body)

Like let-flow but supports :when.

(let-flow [x (future (fn [] 0))
         :when (= x 0)
         y (+ x 1)
         z (future (fn [] (inc y)))]
[x y z])```
Like let-flow but supports :when.
```
(let-flow [x (future (fn [] 0))
         :when (= x 0)
         y (+ x 1)
         z (future (fn [] (inc y)))]
[x y z])```
sourceraw docstring

loopcljmacro

(loop bindings & body)

A version of Clojure's loop which allows for asynchronous loops, via qbits.auspex/recur. loop will always return a CompletableFuture Value, even if the body is synchronous. Note that loop does not coerce values to deferreds, actual qbits.auspex/futures must be used.

(loop [i 1e6] (chain (future i) #(if (zero? %) % (recur (dec %)))))

A version of Clojure's loop which allows for asynchronous loops, via
`qbits.auspex/recur`.  `loop` will always return a CompletableFuture
Value, even if the body is synchronous.  Note that `loop` does
**not** coerce values to deferreds, actual `qbits.auspex/future`s
must be used.

 (loop [i 1e6]
   (chain (future i)
     #(if (zero? %)
        %
        (recur (dec %)))))
sourceraw docstring

oneclj

(one & cfs)

Returns one value from a list of futures

Returns one value from a list of futures
sourceraw docstring

realized?clj

source

recurclj

(recur & args)

Like recur, but to be used with qbits.auspex/loop

Like recur, but to be used with `qbits.auspex/loop`
sourceraw docstring

recur?clj

(recur? x)
source

success!clj

source

success-futureclj

(success-future x)

Returns a new CompletableFuture that is already completed with the given value.

Returns a new CompletableFuture that is already completed with the
given value.
sourceraw docstring

thenclj

source

timeout!clj

source

when-completeclj

source

zipclj

(zip & xs)

Takes a list of values, some of which can be futures and returns a future that will contains a list of realized values

Takes a list of values, some of which can be futures and returns a
future that will contains a list of realized values
sourceraw docstring

zip'clj

(zip' & fs)

Like zip but faster if you know you're only dealing with futures args

Like zip but faster if you know you're only dealing with futures
args
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close