Building Antidote releases
Prerequisites
- An UNIX-like OS
- Erlang 18.3 or later
Getting Antidote
The source code is available open-source at Github.
You can clone it to your machine via
git clone git@github.com:SyncFree/antidote.git
Building a single node cluster
Antidote uses rebar3 for building releases.
make rel
Rebar3 will now pull all the dependencies it needs from Github, and build the application, and make an Erlang “release” of a single node. If all went well (if it didn’t, contact antidotedb-support), then you should be able to start a node:
15:55:05:antidote $ make console
(elided)
Eshell V5.10.3 (abort with ^G)
(antidote@127.0.0.1)1>
Type Ctrl-g
and q
to quit the shell and stop the node.
Reading from and writing to a CRDT object stored in antidote:
Antidote can store and manage different crdts. Here we see how to update and read a counter.
Start a node (if you haven’t done it yet):
make console
Writing
Perform a write operation (example):
CounterObj = {my_counter, antidote_crdt_counter, my_bucket}.
{ok, TxId} = antidote:start_transaction(ignore, []).
ok = antidote:update_objects([{CounterObj, increment, 1}], TxId).
{ok, _CommitTime} = antidote:commit_transaction(TxId).
You can also update objects with a single call as follows:
CounterObj = {my_counter, antidote_crdt_counter, my_bucket}.
{ok, _CommitTime} = antidote:update_objects(ignore, [], [{CounterObj, increment, 1}]).
Reading
Perform a read operation (example):
CounterObj = {my_counter, antidote_crdt_counter, my_bucket}.
{ok, TxId} = antidote:start_transaction(ignore, []).
{ok, [CounterVal]} = antidote:read_objects([CounterObj], TxId).
{ok, _CommitTime3} = antidote:commit_transaction(TxId).
Or in a single call:
CounterObj = {my_counter, antidote_crdt_counter, my_bucket}.
{ok, Res, _CommitTime} = antidote:read_objects(ignore, [], [CounterObj]).
[CounterVal] = Res.
More about the API is described here.
Running Tests
Run all tests
make systests
Running specific tests
Tests are located in $ANTIDOTE/test/
make systests SUITE=xxx_SUITE