Skip to content
Browse files

Change legacy_vnode_routing logic to use new capability system

  • Loading branch information...
1 parent d83fee8 commit d832e07322c602f7685a929c4e6ea8bd181b7940 @jtuple jtuple committed
Showing with 15 additions and 6 deletions.
  1. +9 −0 src/riak_core_app.erl
  2. +6 −6 src/riak_core_vnode_master.erl
View
9 src/riak_core_app.erl
@@ -98,6 +98,15 @@ start(_StartType, _StartArgs) ->
[lager:posix_error(Reason)]),
throw({error, Reason})
end,
+
+ %% Register capabilities
+ riak_core_capability:register({riak_core, vnode_routing},
+ [proxy, legacy],
+ legacy,
+ {riak_core,
+ legacy_vnode_routing,
+ [{true, legacy}, {false, proxy}]}),
+
{ok, Pid};
{error, Reason} ->
{error, Reason}
View
12 src/riak_core_vnode_master.erl
@@ -100,10 +100,10 @@ coverage(Msg, {Index, Node}, Keyspaces, Sender, VMaster) ->
%% VnodePid}'.
command_return_vnode({Index,Node}, Msg, Sender, VMaster) ->
Req = make_request(Msg, Sender, Index),
- case app_helper:get_env(riak_core, legacy_vnode_routing, true) of
- true ->
+ case riak_core_capability:get({riak_core, vnode_routing}) of
+ legacy ->
gen_server:call({VMaster, Node}, {return_vnode, Req});
- false ->
+ proxy ->
Mod = vmaster_to_vmod(VMaster),
riak_core_vnode_proxy:command_return_vnode({Mod,Index,Node}, Req)
end.
@@ -162,10 +162,10 @@ init([Service, VNodeMod, LegacyMod, _RegName]) ->
legacy=LegacyMod}}.
proxy_cast({VMaster, Node}, Req) ->
- case app_helper:get_env(riak_core, legacy_vnode_routing, true) of
- true ->
+ case riak_core_capability:get({riak_core, vnode_routing}) of
+ legacy ->
gen_server:cast({VMaster, Node}, Req);
- false ->
+ proxy ->
do_proxy_cast({VMaster, Node}, Req)
end.

0 comments on commit d832e07

Please sign in to comment.
Something went wrong with that request. Please try again.