A Zookeeper-based reference type
A Zookeeper-based reference type
(add-versioned-watch z k f)
Adds a watch function to the zref z. The watch fn must be a fn of 4 args:
the key, the zref, its old-state and its new-state. Whenever the zref's
state might have been changed, any registered watches will have their
functions called. Note that the zref's state may have changed again
prior to the fn call, so use old/new-state rather than derefing the zref.
Note also that watch fns may be called from multiple threads
simultaneously. Keys must be unique per zref, and can be used to remove
the watch with remove-watch
, but are otherwise considered opaque
by the watch mechanism.
Adds a watch function to the zref z. The watch fn must be a fn of 4 args: the key, the zref, its old-state and its new-state. Whenever the zref's state might have been changed, any registered watches will have their functions called. Note that the zref's state may have changed again prior to the fn call, so use old/new-state rather than derefing the zref. Note also that watch fns may be called from multiple threads simultaneously. Keys must be unique per zref, and can be used to remove the watch with `remove-watch`, but are otherwise considered opaque by the watch mechanism.
(compare-version-and-set! z current-version newval)
Atomically sets the value of z to newval
if and only if the current
version of z
is identical to current-version
. Returns true if set
happened, else false
Atomically sets the value of z to `newval` if and only if the current version of `z` is identical to `current-version`. Returns true if set happened, else false
(create root-znode path default & options)
(versioned-deref z)
Return the current state (value and version) of the zref z
.
Return the current state (value and version) of the zref `z`.
(compareVersionAndSet this current-version new-value)
Set to new-value only when current-version is latest
Set to new-value only when current-version is latest
(vAddWatch this k f)
Add versioned watcher that will be called with new value and version
Add versioned watcher that will be called with new value and version
(vDeref this)
Return referenced value and version
Return referenced value and version
(path this)
Return the path of the backing ZNode
Return the path of the backing ZNode
(start this)
Start online operations
Start online operations
(update! this version value)
Update the znode backing this zref
Update the znode backing this zref
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close