A sweet Clojure API for Atomix.
Add the Leiningen dependency:
[io.atomix/trinity "0.1.0-SNAPSHOT"]
(require '[trinity.core :as trinity])
Create an Atomix replica specifying local port to listen on and a set of remote servers that the replica should connect to:
(trinity/replica
5555
[{:host node2 :port 5555}
{:host node3 :port 5555}])
Create an Atomix client for a set of servers:
(trinity/client
[{:host node1 :port 5555}
{:host node2 :port 5555}
{:host node3 :port 5555}])
Open an Atomix client or replica:
(trinity/open! atomix)
Close an Atomix client or replica:
(trinity/close! atomix)
Note: Trinity functions operate sychronously by default, but many functions have async counterparts such as open-async!
which return CompletableFuture.
(require '[trinity.distributed-value :as dvalue])
Create a distributed value on a path:
(dvalue/create client "register")
Operate on the value:
(dvalue/get value)
(dvalue/set! value "value")
(dvalue/cas! value "expected" "updated")
API docs are available here.
Copyright © 2015 Jonathan Halterman
Distributed under the Eclipse Public License either version 1.0
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close