Skip to content

Commit f844a08

Browse files
committed
Add support for membership request/response
1 parent d9fa463 commit f844a08

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

rebar.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
]}.
1818

1919
{deps, [
20-
{riak_pb, {git, "https://github.com/basho/riak_pb", {tag, "3.0.8"}}}
20+
{riak_pb, {git, "https://github.com/basho/riak_pb", {branch, "mas-i1804-peerdiscovery"}}}
2121
]}.
2222

2323
{edoc_opts, [

src/riakc_pb_socket.erl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
get_server_info/1, get_server_info/2,
5151
get/3, get/4, get/5,
5252
fetch/2, fetch/3, push/3,
53+
peer_discovery/1,
5354
put/2, put/3, put/4,
5455
delete/3, delete/4, delete/5,
5556
delete_vclock/4, delete_vclock/5, delete_vclock/6,
@@ -380,6 +381,12 @@ push(Pid, QueueName, BucketKeyClockList) ->
380381
Req = #rpbpushreq{queuename = QueueName, keys_value = KeysValue},
381382
call_infinity(Pid, {req, Req, default_timeout(get_timeout)}).
382383

384+
385+
-spec peer_discovery(pid()) -> {error, term()}|{ok, iolist()}.
386+
peer_discovery(Pid) ->
387+
Req = #rpbmembershipreq{},
388+
call_infinity(Pid, {req, Req, default_timeout(get_timeout)}).
389+
383390
make_keyvalue({{T, B}, K, C}) ->
384391
#rpbkeysvalue{type = T, bucket = B, key = K, value = C};
385392
make_keyvalue({B, K, C}) ->
@@ -2505,12 +2512,17 @@ process_response(#request{msg = #rpbpushreq{queuename = Q}},
25052512
iolist_to_binary(
25062513
io_lib:format("Queue ~s: ~w ~w ~w", [Q, FL, FSL, RTL]))},
25072514
State};
2515+
2516+
%% rpbmembershipreq
25082517
process_response(#request{msg = #rpbpushreq{queuename = Q}},
25092518
#rpbpushresp{queue_exists = false}, State) ->
25102519
{reply,
25112520
{ok,
25122521
iolist_to_binary(io_lib:format("No queue ~s", [Q]))},
25132522
State};
2523+
process_response(#request{msg = #rpbmembershipreq{}},
2524+
#rpbmembershipresp{up_nodes = UpNodeList}, State) ->
2525+
{reply, {ok, UpNodeList}, State};
25142526

25152527

25162528

0 commit comments

Comments
 (0)