std.lib.stream.async

+stream:async+

blocking-seq

added in 3.0

(blocking-seq queue)

constructs a blocking seq

blocking?

added in 3.0

(blocking? obj)

checks that object implements IBLocking

(blocking? (q/queue)) => true

collect-flux

added in 3.0

(collect-flux {:keys [id queue], :as flux} xform supply)

writes to a flux

(collect-flux (flux) identity (range 5))

flux

added in 3.0

(flux)(flux id)

constructs a flux

flux?

added in 3.0

(flux? obj)

checks if object is a flux

(flux? (flux)) => true

i:async

added in 3.0

(i:async)(i:async f)(i:async f {:keys [pool timeout delay default], :as m})

constructs an async transducer

(->> (sequence (i:async inc) (range 5)) (map deref)) => ’(1 2 3 4 5)

i:guard

added in 3.0

(i:guard pred accept)(i:guard pred accept reject)(i:guard pred accept reject {:keys [pool timeout delay default collect], :as m})

constructs a guard transducer

i:step

added in 3.0

(i:step)(i:step f)(i:step f {:keys [pool timeout delay default collect], :as m})

constructs a step transducer

ipending?

added in 3.0

(ipending? obj)

true for promise and future

(ipending? (promise)) => true

mono

added in 3.0

(mono)(mono {:keys [future data parent]})

constructs a mono

(mono {:future (f/completed 1) :data (atom {:name “hello”}) :parent (mono)}) => mono?

mono?

added in 3.0

(mono? obj)

checks if object is a mono

(mono? (mono))

next-stage

added in 3.0

(next-stage obj f m)

constructs the next stage

@(next-stage (mono {:future (f/completed 1)}) inc {}) => 2

process-mono

added in 3.0

(process-mono mono f obj m)

chains monos together

@(process-mono (mono) inc 1 {}) => 2

produce-flux

added in 3.0

(produce-flux {:keys [id queue]})

takes from a flux

(map realized? (take 2 (produce-flux (flux)))) => ’(false false)

realize

added in 3.0

(realize obj)

retrieves linked future result

(realize (f/future (f/future (f/future 3)))) => 3

realized?

added in 3.0

(realized? obj)

checks if all linked futures are realized

(realized? (f/completed (f/completed 1))) => true

stage-realize

added in 3.0

(stage-realize obj)

returns the unwrapped result

(stage-realize (f/future (Thread/sleep 10) 1)) => 1

stage-realized?

added in 3.0

(stage-realized? obj)

checks if unwrapped result is realized

(stage-realized? (mono {:future (f/completed (f/completed 1))})) => true

stage-unit

added in 3.0

(stage-unit obj)

returns the base future unit

(stage-unit (mono {:future |f|})) => |f|

stage?

added in 3.0

(stage? obj)

checks if object implements IStage

(stage? (f/completed 1)) => true

take-element

added in 3.0

(take-element queue)

takes an element from a queue

wrap-collectors

added in 3.0

(wrap-collectors f {:keys [data]} collectors)

wrap collectors given async function

wrap-stage

added in 3.0

(wrap-stage f)

helper for unwrapping nested futures

@@((wrap-stage inc) (f/completed (f/completed 1))) => 2

wrap-time

added in 3.0

(wrap-time f)

wraps timing given the output

((wrap-time inc) 1) => (contains number? 2)