Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
bin
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

trinity

Clojars license

A sweet Clojure API for Atomix.

Core Usage

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

Using Atomix Resources

Distributed Value

Get a distributed value for some resource name:

(def register 
  (trinity/get-value client "register"))

Operate on the value:

(require '[trinity.distributed-value :as dvalue])

(dvalue/get register)
(dvalue/set! register "value")
(dvalue/cas! register "expected" "updated")

Distributed Map

Get a distributed map for some resource name:

(def cache 
  (trinity/get-map client "cache"))

Operate on the map:

(require '[trinity.distributed-map :as dmap])

(dmap/get cache "key")
(dvalue/put! cache "key" "value")
(dvalue/remove! cache "key")

Docs

API docs are available here.

License

Copyright © 2015-2016 Atomix contributors

Distributed under the Eclipse Public License either version 1.0

About

A sweet Clojure API for Atomix

Resources

License

Releases

No releases published
You can’t perform that action at this time.