Liking cljdoc? Tell your friends :D

net.cgrand.megaref

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).
raw docstring

alterclj

(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).
sourceraw docstring

alter-inclj

(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.
sourceraw docstring

AssociativeRefcljprotocol

-alter-inclj

(-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-inclj

(-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-inclj

(deref-in aref ks)

Equivalent to (get-in @aref ks).

Equivalent to (get-in @aref ks).

ensure-inclj

(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-inclj

(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.
source

commuteclj

(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).
sourceraw docstring

commute-inclj

(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.
sourceraw docstring

ensureclj

(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).
sourceraw docstring

megarefclj

(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!
sourceraw docstring

ref-setclj

(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).
sourceraw docstring

subrefclj

(subref ref ks)
source

Tuneablecljprotocol

get-optionsclj

(get-options this)

set-option!clj

(set-option! this option value)
source

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

× close