Quickstart with Docker

Prerequisites

  • Working recent version of Docker (1.12 and up recommended)

Starting a local node

Start a local node with the command

docker run -d --name antidote -p "8087:8087" antidotedb/antidote

This should fetch the Antidote image automatically. For updating to the latest version use the command docker pull antidotedb/antidote.

Wait until Antidote is ready. The current log can be inspected with docker logs antidote. Wait until the log message Application antidote started on node 'antidote@127.0.0.1' appears.

Antidote should now be running on port 8087 on localhost.

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 us at info@antidotedb.com), 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

  1. make systests

Running specific tests

Tests are located in $ANTIDOTE/test/

  1. make systests SUITE=xxx_SUITE