Skip to content

Commit

Permalink
Merge pull request #404 from basho/mas-i1804-peerdiscovery
Browse files Browse the repository at this point in the history
Mas i1804 peerdiscovery
  • Loading branch information
martinsumner authored May 12, 2022
2 parents d9fa463 + aab191c commit bdfc8f0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
]}.

{deps, [
{riak_pb, {git, "https://github.com/basho/riak_pb", {tag, "3.0.8"}}}
{riak_pb, {git, "https://github.com/basho/riak_pb", {branch, "develop-3.0"}}}
]}.

{edoc_opts, [
Expand Down
18 changes: 17 additions & 1 deletion src/riakc_pb_socket.erl
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
get_server_info/1, get_server_info/2,
get/3, get/4, get/5,
fetch/2, fetch/3, push/3,
peer_discovery/1,
put/2, put/3, put/4,
delete/3, delete/4, delete/5,
delete_vclock/4, delete_vclock/5, delete_vclock/6,
Expand Down Expand Up @@ -380,6 +381,12 @@ push(Pid, QueueName, BucketKeyClockList) ->
Req = #rpbpushreq{queuename = QueueName, keys_value = KeysValue},
call_infinity(Pid, {req, Req, default_timeout(get_timeout)}).


-spec peer_discovery(pid()) -> {error, term()}|{ok, iolist()}.
peer_discovery(Pid) ->
Req = #rpbmembershipreq{},
call_infinity(Pid, {req, Req, default_timeout(get_timeout)}).

make_keyvalue({{T, B}, K, C}) ->
#rpbkeysvalue{type = T, bucket = B, key = K, value = C};
make_keyvalue({B, K, C}) ->
Expand Down Expand Up @@ -2512,7 +2519,16 @@ process_response(#request{msg = #rpbpushreq{queuename = Q}},
iolist_to_binary(io_lib:format("No queue ~s", [Q]))},
State};


%% rpbmembershipreq
process_response(#request{msg = #rpbmembershipreq{}},
#rpbmembershipresp{up_nodes = UpNodeList}, State) ->
ErlifiedInfo =
lists:map(
fun(ME) ->
{ME#rpbclustermemberentry.ip, ME#rpbclustermemberentry.port}
end,
UpNodeList),
{reply, {ok, ErlifiedInfo}, State};

%% rpbputreq
process_response(#request{msg = #rpbputreq{}},
Expand Down

0 comments on commit bdfc8f0

Please sign in to comment.