Using Riak Erlang Client Library in Nitrogen

This question is a continuation of the Erlang client library that was asked earlier.

I managed to turn on the library by changing:

{mimetypes,     ".*",   {git, "git://github.com/spawngrid/mimetypes",   {branch, master}}},

%% Uncomment the following lines and comment the bottom lines with specific
%% tags to always pull the latest versions
{nitrogen_core, ".*",   {git, "git://github.com/nitrogen/nitrogen_core",{branch, master}}},

at

{mimetypes,     ".*",   {git, "git://github.com/spawngrid/mimetypes",   {branch, master}}},

{riakc, "1.4.1",
          {git, "git://github.com/basho/riak-erlang-client", 
                       {tag, "1.4.1"}}},


%% Uncomment the following lines and comment the bottom lines with specific
%% tags to always pull the latest versions
{nitrogen_core, ".*",   {git, "git://github.com/nitrogen/nitrogen_core",{branch, master}}},

in rel/nitrogen/rebar.configand recompiling with make

Now that I have those installed in the folder lib, I'm not sure where I should use riakc_pb_socketlib as suggested in the docs

I tried to put

{ok, Pid} = riakc_pb_socket:start_link("127.0.0.1", 8087),

in nitrogen_sup:init(), but I get this error message:

application: nitrogen
exited: {{{badmatch,{error,{tcp,econnrefused}}},
          [{nitrogen_sup,init,1,
                         [{file,"/home/neil/proj/nitrogen/rel/nitrogen/site/src/nitrogen_sup.erl"},
                          {line,43}]},
           {supervisor,init,1,[{file,"supervisor.erl"},{line,239}]},
           {gen_server,init_it,6,[{file,"gen_server.erl"},{line,304}]},
           {proc_lib,init_p_do_apply,3,
                     [{file,"proc_lib.erl"},{line,239}]}]},
         {nitrogen_app,start,[normal,[]]}}
type: temporary

riak . , , , .

erlang/OTP , .

:

bin/nitrogen console, {ok, Pid} = riakc_pb_socket:start_link("127.0.0.1",8087)., pong riakc_pb_socket:ping(Pid).

: / riak //?

0
1

:

  • gen_server, . , .
  • gen_server, Riak. , , call gen_server, , .
  • . , gen_server. , .

, "" Erlang, , , -. gen_server "backend".

, :

Erlang. foo , . - , . , , , .

+2

Source: https://habr.com/ru/post/1775793/


All Articles