fix(bpapi): Add exceptions for experimental features
This commit is contained in:
parent
02b72d79fc
commit
8c6d8bdd12
|
@ -81,6 +81,12 @@
|
||||||
"emqx_mgmt_api:do_query/2, emqx_mgmt_api:collect_total_from_tail_nodes/2"
|
"emqx_mgmt_api:do_query/2, emqx_mgmt_api:collect_total_from_tail_nodes/2"
|
||||||
).
|
).
|
||||||
|
|
||||||
|
%% Only the APIs for the features that haven't reached General
|
||||||
|
%% Availability can be added here:
|
||||||
|
-define(EXPERIMENTAL_APIS, [
|
||||||
|
{emqx_ds, 4}
|
||||||
|
]).
|
||||||
|
|
||||||
-define(XREF, myxref).
|
-define(XREF, myxref).
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -132,34 +138,47 @@ check_compat(_, _) ->
|
||||||
check_api_immutability(#{release := Rel1, api := APIs1}, #{release := Rel2, api := APIs2}) ->
|
check_api_immutability(#{release := Rel1, api := APIs1}, #{release := Rel2, api := APIs2}) ->
|
||||||
%% TODO: Handle API deprecation
|
%% TODO: Handle API deprecation
|
||||||
_ = maps:map(
|
_ = maps:map(
|
||||||
fun(Key = {API, Version}, Val) ->
|
fun(Key, Val) ->
|
||||||
case maps:get(Key, APIs2, undefined) of
|
case lists:member(Key, ?EXPERIMENTAL_APIS) of
|
||||||
Val ->
|
true ->
|
||||||
ok;
|
ok;
|
||||||
undefined ->
|
false ->
|
||||||
case lists:member(Key, ?FORCE_DELETED_APIS) of
|
do_check_api_immutability(Rel1, Rel2, APIs2, Key, Val)
|
||||||
true ->
|
end
|
||||||
ok;
|
|
||||||
false ->
|
|
||||||
setnok(),
|
|
||||||
logger:error(
|
|
||||||
"API ~p v~p was removed in release ~p without being deprecated. "
|
|
||||||
"Old release: ~p",
|
|
||||||
[API, Version, Rel2, Rel1]
|
|
||||||
)
|
|
||||||
end;
|
|
||||||
_Val ->
|
|
||||||
setnok(),
|
|
||||||
logger:error(
|
|
||||||
"API ~p v~p was changed between ~p and ~p. Backplane API should be immutable.",
|
|
||||||
[API, Version, Rel1, Rel2]
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
APIs1
|
APIs1
|
||||||
),
|
),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
do_check_api_immutability(Rel1, Rel2, APIs2, Key = {API, Version}, Val) ->
|
||||||
|
case maps:get(Key, APIs2, undefined) of
|
||||||
|
Val ->
|
||||||
|
ok;
|
||||||
|
undefined ->
|
||||||
|
case lists:member(Key, ?FORCE_DELETED_APIS) of
|
||||||
|
true ->
|
||||||
|
ok;
|
||||||
|
false ->
|
||||||
|
setnok(),
|
||||||
|
logger:error(
|
||||||
|
"API ~p v~p was removed in release ~p without being deprecated. "
|
||||||
|
"Old release: ~p",
|
||||||
|
[API, Version, Rel2, Rel1]
|
||||||
|
)
|
||||||
|
end;
|
||||||
|
OldVal ->
|
||||||
|
setnok(),
|
||||||
|
logger:error(
|
||||||
|
"API ~p v~p was changed between ~p and ~p. Backplane API should be immutable.",
|
||||||
|
[API, Version, Rel1, Rel2]
|
||||||
|
),
|
||||||
|
D21 = maps:get(calls, Val) -- maps:get(calls, OldVal),
|
||||||
|
D12 = maps:get(calls, OldVal) -- maps:get(calls, Val),
|
||||||
|
logger:error("Added calls:~n ~p", [D21]),
|
||||||
|
logger:error("Removed calls:~n ~p", [D12])
|
||||||
|
end.
|
||||||
|
|
||||||
|
|
||||||
filter_calls(Calls) ->
|
filter_calls(Calls) ->
|
||||||
F = fun({{Mf, _, _}, {Mt, _, _}}) ->
|
F = fun({{Mf, _, _}, {Mt, _, _}}) ->
|
||||||
(not lists:member(Mf, ?FORCE_DELETED_MODULES)) andalso
|
(not lists:member(Mf, ?FORCE_DELETED_MODULES)) andalso
|
||||||
|
|
Loading…
Reference in New Issue