std.concurrent.atom

aq:executor

added in 3.0

(aq:executor {:keys [target], :as opts})

creates a executor that takes in an atom queue

aq:new

added in 3.0

(aq:new)

creates an atom with a vec as queue

aq:process

added in 3.0

(aq:process f aq max-batch)

processes

(def +state+ (atom []))

(aq:process (fn elems(swap! +state+ conj elems)) (atom 1 2 3 4 5) 3)

@+state+ => [1 2 3 4 5]

aq:submit

added in 3.0

(aq:submit executor queue {:keys [target handler max-batch interval], :as opts})

submission function for one or multiple entries to aq

hub-state

added in 4.0

(hub-state elems)

creates a hub state

hub:add-entries

added in 3.0

(hub:add-entries hub entries)

adds entries to the hub

(hub:add-entries (hub:new) 1 2 3 4 5) => (contains f/future? 0 5)

hub:executor

added in 3.0

(hub:executor object {:keys [handler max-batch interval], :as opts})

creates a hub based executor

(def -exe- (hub:executor nil {:handler (fn & args args) :interval 50 :max-batch 1000}))

(do (def -res- ((:submit -exe-) 1 2 3 4 5 6)) @(first -res-)) => ’(nil (1 2 3 4 5 6))

(hub:wait (:queue -exe-)) => nil

hub:new

added in 3.0

(hub:new)(hub:new elems)

creates a trackable atom queue

hub:process

added in 3.0

(hub:process f hub max-batch)

like aq:process but with a hub

(def +state+ (atom []))

(hub:process (fn elems(swap! +state+ conj elems)) (hub:new 1 2 3 4 5) 3)

@+state+ => [1 2 3 4 5]

hub:submit

added in 3.0

(hub:submit object executor hub {:keys [handler max-batch interval]})

submission function for the hub

hub:wait

added in 4.0

(hub:wait hub & [timeout])

waits for the hub executor to be ready