STM ref types specialized for associative data. Those megarefs allow for more concurrency than a single ref while still being cheap to snapshot (compared to a lot of hot refs).
STM ref types specialized for associative data. Those megarefs allow for more concurrency than a single ref while still being cheap to snapshot (compared to a lot of hot refs).
(alter r f & args)
Same as clojure.core/alter but works on AssociativeRefs too (by assuming an empty path).
Same as clojure.core/alter but works on AssociativeRefs too (by assuming an empty path).
(alter-in aref ks f & args)
Must be called in a transaction. Sets the in-transaction-value of aref to:
(apply update-in in-transaction-value-of-ref ks f args)
and returns the in-transaction-value of the altered part (not the whole aref value).
At the commit point of the transaction, sets the value of ref to be:
(assoc-in most-recently-committed-value-of-ref ks (get-in in-transaction-value-of-ref ks))
while maintaining the guarantee that concurrent transactions didn't change (get-in value-of-ref ks). Thus alter-in offers the alter semantics at the path level rather than at the ref level. Two concurrent alter-in can commute when their paths are not prefix from one another.
Must be called in a transaction. Sets the in-transaction-value of aref to: (apply update-in in-transaction-value-of-ref ks f args) and returns the in-transaction-value of the altered part (not the whole aref value). At the commit point of the transaction, sets the value of ref to be: (assoc-in most-recently-committed-value-of-ref ks (get-in in-transaction-value-of-ref ks)) while maintaining the guarantee that concurrent transactions didn't change (get-in value-of-ref ks). Thus alter-in offers the alter semantics at the path level rather than at the ref level. Two concurrent alter-in can commute when their paths are not prefix from one another.
(-alter-in aref ks f args)
Protocol method backing alter-in. Must return the newly set in-transaction-value of aref
Protocol method backing alter-in. Must return the newly set in-transaction-value of aref
(-commute-in aref ks f args)
Protocol method backing commute-in. Must return the newly set in-transaction-value of aref
Protocol method backing commute-in. Must return the newly set in-transaction-value of aref
(deref-in aref ks)
Equivalent to (get-in @aref ks).
Equivalent to (get-in @aref ks).
(ensure-in aref ks)
Must be called in a transaction. Protects a part of the ref from modification by other transactions. Returns the in-transaction-value of this part of the ref (that is (deref-in aref ks)).
Must be called in a transaction. Protects a part of the ref from modification by other transactions. Returns the in-transaction-value of this part of the ref (that is (deref-in aref ks)).
(ref-set-in aref ks v)
Equivalent to (alter aref assoc-in ks v) but allows for more concurrency and returns v.
Equivalent to (alter aref assoc-in ks v) but allows for more concurrency and returns v.
(commute r f & args)
Same as clojure.core/commute but works on AssociativeRefs too (by assuming an empty path).
Same as clojure.core/commute but works on AssociativeRefs too (by assuming an empty path).
(commute-in aref ks f & args)
Must be called in a transaction. Sets the in-transaction-value of aref to:
(apply update-in in-transaction-value-of-ref ks f args)
and returns the in-transaction-value of the commuted part (not the whole aref value).
At the commit point of the transaction, sets the value of ref to be:
(apply update-in most-recently-committed-value-of-ref ks f args)
Thus f should be commutative, or, failing that, you must accept last-one-in-wins behavior. commute-in allows for more concurrency than alter-in.
Must be called in a transaction. Sets the in-transaction-value of aref to: (apply update-in in-transaction-value-of-ref ks f args) and returns the in-transaction-value of the commuted part (not the whole aref value). At the commit point of the transaction, sets the value of ref to be: (apply update-in most-recently-committed-value-of-ref ks f args) Thus f should be commutative, or, failing that, you must accept last-one-in-wins behavior. commute-in allows for more concurrency than alter-in.
(ensure r)
Same as clojure.core/ensure but works on AssociativeRefs too (by assuming an empty path).
Same as clojure.core/ensure but works on AssociativeRefs too (by assuming an empty path).
(megaref x & {:as options})
Creates and returns an associative ref with an initial value of x and zero or more options (in any order):
:validator validate-fn
:min-history (default 0) :max-history (default 10) :guards-count (default to 32) :guard-prefixes (default to true)
Options can be queryed by #'get-options and changed with #'set-option!
Creates and returns an associative ref with an initial value of x and zero or more options (in any order): :validator validate-fn :min-history (default 0) :max-history (default 10) :guards-count (default to 32) :guard-prefixes (default to true) Options can be queryed by #'get-options and changed with #'set-option!
(ref-set r v)
Same as clojure.core/ref-set but works on AssociativeRefs too (by assuming an empty path).
Same as clojure.core/ref-set but works on AssociativeRefs too (by assuming an empty path).
(get-options this)
(set-option! this option value)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close