feat(bpapi): Verify emqx cluster RPC
This commit is contained in:
parent
b2b6cff469
commit
d25258943b
|
@ -48,6 +48,8 @@
|
|||
-define(IGNORED_MODULES, "emqx_rpc").
|
||||
%% List of known RPC backend modules:
|
||||
-define(RPC_MODULES, "gen_rpc, erpc, rpc, emqx_rpc").
|
||||
%% List of known functions also known to do RPC:
|
||||
-define(RPC_FUNCTIONS, "emqx_cluster_rpc:multicall/3, emqx_cluster_rpc:multicall/5").
|
||||
%% List of functions in the RPC backend modules that we can ignore:
|
||||
-define(IGNORED_RPC_CALLS, "gen_rpc:nodes/0").
|
||||
|
||||
|
@ -206,7 +208,7 @@ prepare(#{reldir := RelDir, plt := PLT}) ->
|
|||
|
||||
find_remote_calls(_Opts) ->
|
||||
Query = "XC | (A - [" ?IGNORED_APPS "]:App - [" ?IGNORED_MODULES "] : Mod)
|
||||
|| ([" ?RPC_MODULES "] : Mod - " ?IGNORED_RPC_CALLS ")",
|
||||
|| (([" ?RPC_MODULES "] : Mod + [" ?RPC_FUNCTIONS "]) - " ?IGNORED_RPC_CALLS ")",
|
||||
{ok, Calls} = xref:q(?XREF, Query),
|
||||
?INFO("Calls to RPC modules ~p", [Calls]),
|
||||
{Callers, _Callees} = lists:unzip(Calls),
|
||||
|
|
|
@ -158,6 +158,11 @@ extract_mfa(?BACKEND(RPC, CallOrCast), [_Node, M, F, A]) when ?IS_RPC(RPC) ->
|
|||
{call_or_cast(CallOrCast), M, F, A};
|
||||
extract_mfa(?BACKEND(RPC, CallOrCast), [_Node, M, F, A, _Timeout]) when ?IS_RPC(RPC) ->
|
||||
{call_or_cast(CallOrCast), M, F, A};
|
||||
%% emqx_cluster_rpc:
|
||||
extract_mfa(?BACKEND(emqx_cluster_rpc, multicall), [M, F, A]) ->
|
||||
{call, M, F, A};
|
||||
extract_mfa(?BACKEND(emqx_cluster_rpc, multicall), [M, F, A, _RequiredNum, _Timeout]) ->
|
||||
{call, M, F, A};
|
||||
extract_mfa(_, _) ->
|
||||
error("unrecognized RPC call").
|
||||
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
|
||||
%% API
|
||||
-export([start_link/0, mnesia/1]).
|
||||
|
||||
%% Note: multicall functions are statically checked by
|
||||
%% `emqx_bapi_trans' and `emqx_bpapi_static_checks' modules. Don't
|
||||
%% forget to update it when adding or removing them here:
|
||||
-export([multicall/3, multicall/5, query/1, reset/0, status/0,
|
||||
skip_failed_commit/1, fast_forward_to_commit/2]).
|
||||
-export([get_node_tnx_id/1, latest_tnx_id/0]).
|
||||
|
|
Loading…
Reference in New Issue