Ram - an in-memory distributed KV store

Hi Roberto,

this morning I played a bit with ram, I compressed your erlang example in a CT module and
used peer (with OTP 25 rc2) to orchestrate:

my_test_case(_Config) ->
    NodeNames = [ram1, ram2, ram3],
    %% /tmp/all/ contains all beam and app files from 
    %% aten, gen_batch_server, ram and ra
    Args = ["-pa", "/tmp/all" ],
    PidsNodes  = 
        lists:map(fun(P) -> 
                          {ok, Pid, Node} = peer:start_link(#{
                                                              name => P, 
                                                              connection => standard_io,
                                                              args => Args}),
                          true = peer:call(Pid, net_kernel, connect_node, [Node]),
                          {Pid, Node}
                  end,
                  NodeNames),
    [P1,P2,P3]  = [Pid || {Pid, _Node} <- PidsNodes],
    Nodes = [Node || {_Pid, Node} <- PidsNodes],
    peer:call(P1, ram, start_cluster, [Nodes]),
    peer:call(P1, ram, put, ["key", "value"]),
    "value" = peer:call(P1, ram, get, ["key"]),
    "value" = peer:call(P2, ram, get, ["key"]),
    "value" = peer:call(P3, ram, get, ["key"]),
    peer:stop(P1),
    peer:stop(P2),
    peer:stop(P3).

a complete repository is here: GitHub - dischoen/rampeer: play with ram in peers.

Btw, in the documentation you use the URL “git://github.com/ostinelli/ram.git”,
rebar3 3.18 cannot read from there.
I replaced it with git@github.com:ostinelli/ram.git

5 Likes