|
|
@@ -112,8 +112,8 @@
|
|
|
%%--------------------------------------------------------------------
|
|
|
|
|
|
list_nodes() ->
|
|
|
- Running = mria_mnesia:cluster_nodes(running),
|
|
|
- Stopped = mria_mnesia:cluster_nodes(stopped),
|
|
|
+ Running = mria:cluster_nodes(running),
|
|
|
+ Stopped = mria:cluster_nodes(stopped),
|
|
|
DownNodes = lists:map(fun stopped_node_info/1, Stopped),
|
|
|
[{Node, Info} || #{node := Node} = Info <- node_info(Running)] ++ DownNodes.
|
|
|
|
|
|
@@ -199,7 +199,7 @@ vm_stats() ->
|
|
|
%%--------------------------------------------------------------------
|
|
|
|
|
|
list_brokers() ->
|
|
|
- Running = mria_mnesia:running_nodes(),
|
|
|
+ Running = mria:running_nodes(),
|
|
|
[{Node, Broker} || #{node := Node} = Broker <- broker_info(Running)].
|
|
|
|
|
|
lookup_broker(Node) ->
|
|
|
@@ -223,7 +223,7 @@ broker_info(Nodes) ->
|
|
|
%%--------------------------------------------------------------------
|
|
|
|
|
|
get_metrics() ->
|
|
|
- nodes_info_count([get_metrics(Node) || Node <- mria_mnesia:running_nodes()]).
|
|
|
+ nodes_info_count([get_metrics(Node) || Node <- mria:running_nodes()]).
|
|
|
|
|
|
get_metrics(Node) ->
|
|
|
unwrap_rpc(emqx_proto_v1:get_metrics(Node)).
|
|
|
@@ -243,7 +243,7 @@ get_stats() ->
|
|
|
Stats = get_stats(Node),
|
|
|
delete_keys(Stats, GlobalStatsKeys)
|
|
|
end
|
|
|
- || Node <- mria_mnesia:running_nodes()
|
|
|
+ || Node <- mria:running_nodes()
|
|
|
]),
|
|
|
GlobalStats = maps:with(GlobalStatsKeys, maps:from_list(get_stats(node()))),
|
|
|
maps:merge(CountStats, GlobalStats).
|
|
|
@@ -275,12 +275,12 @@ nodes_info_count(PropList) ->
|
|
|
lookup_client({clientid, ClientId}, FormatFun) ->
|
|
|
lists:append([
|
|
|
lookup_client(Node, {clientid, ClientId}, FormatFun)
|
|
|
- || Node <- mria_mnesia:running_nodes()
|
|
|
+ || Node <- mria:running_nodes()
|
|
|
]);
|
|
|
lookup_client({username, Username}, FormatFun) ->
|
|
|
lists:append([
|
|
|
lookup_client(Node, {username, Username}, FormatFun)
|
|
|
- || Node <- mria_mnesia:running_nodes()
|
|
|
+ || Node <- mria:running_nodes()
|
|
|
]).
|
|
|
|
|
|
lookup_client(Node, Key, FormatFun) ->
|
|
|
@@ -307,7 +307,7 @@ kickout_client(ClientId) ->
|
|
|
[] ->
|
|
|
{error, not_found};
|
|
|
_ ->
|
|
|
- Results = [kickout_client(Node, ClientId) || Node <- mria_mnesia:running_nodes()],
|
|
|
+ Results = [kickout_client(Node, ClientId) || Node <- mria:running_nodes()],
|
|
|
check_results(Results)
|
|
|
end.
|
|
|
|
|
|
@@ -322,7 +322,7 @@ list_client_subscriptions(ClientId) ->
|
|
|
[] ->
|
|
|
{error, not_found};
|
|
|
_ ->
|
|
|
- Results = [client_subscriptions(Node, ClientId) || Node <- mria_mnesia:running_nodes()],
|
|
|
+ Results = [client_subscriptions(Node, ClientId) || Node <- mria:running_nodes()],
|
|
|
Filter =
|
|
|
fun
|
|
|
({error, _}) ->
|
|
|
@@ -340,18 +340,18 @@ client_subscriptions(Node, ClientId) ->
|
|
|
{Node, unwrap_rpc(emqx_broker_proto_v1:list_client_subscriptions(Node, ClientId))}.
|
|
|
|
|
|
clean_authz_cache(ClientId) ->
|
|
|
- Results = [clean_authz_cache(Node, ClientId) || Node <- mria_mnesia:running_nodes()],
|
|
|
+ Results = [clean_authz_cache(Node, ClientId) || Node <- mria:running_nodes()],
|
|
|
check_results(Results).
|
|
|
|
|
|
clean_authz_cache(Node, ClientId) ->
|
|
|
unwrap_rpc(emqx_proto_v1:clean_authz_cache(Node, ClientId)).
|
|
|
|
|
|
clean_authz_cache_all() ->
|
|
|
- Results = [{Node, clean_authz_cache_all(Node)} || Node <- mria_mnesia:running_nodes()],
|
|
|
+ Results = [{Node, clean_authz_cache_all(Node)} || Node <- mria:running_nodes()],
|
|
|
wrap_results(Results).
|
|
|
|
|
|
clean_pem_cache_all() ->
|
|
|
- Results = [{Node, clean_pem_cache_all(Node)} || Node <- mria_mnesia:running_nodes()],
|
|
|
+ Results = [{Node, clean_pem_cache_all(Node)} || Node <- mria:running_nodes()],
|
|
|
wrap_results(Results).
|
|
|
|
|
|
wrap_results(Results) ->
|
|
|
@@ -379,7 +379,7 @@ set_keepalive(_ClientId, _Interval) ->
|
|
|
|
|
|
%% @private
|
|
|
call_client(ClientId, Req) ->
|
|
|
- Results = [call_client(Node, ClientId, Req) || Node <- mria_mnesia:running_nodes()],
|
|
|
+ Results = [call_client(Node, ClientId, Req) || Node <- mria:running_nodes()],
|
|
|
Expected = lists:filter(
|
|
|
fun
|
|
|
({error, _}) -> false;
|
|
|
@@ -428,7 +428,7 @@ list_subscriptions(Node) ->
|
|
|
list_subscriptions_via_topic(Topic, FormatFun) ->
|
|
|
lists:append([
|
|
|
list_subscriptions_via_topic(Node, Topic, FormatFun)
|
|
|
- || Node <- mria_mnesia:running_nodes()
|
|
|
+ || Node <- mria:running_nodes()
|
|
|
]).
|
|
|
|
|
|
list_subscriptions_via_topic(Node, Topic, _FormatFun = {M, F}) ->
|
|
|
@@ -442,7 +442,7 @@ list_subscriptions_via_topic(Node, Topic, _FormatFun = {M, F}) ->
|
|
|
%%--------------------------------------------------------------------
|
|
|
|
|
|
subscribe(ClientId, TopicTables) ->
|
|
|
- subscribe(mria_mnesia:running_nodes(), ClientId, TopicTables).
|
|
|
+ subscribe(mria:running_nodes(), ClientId, TopicTables).
|
|
|
|
|
|
subscribe([Node | Nodes], ClientId, TopicTables) ->
|
|
|
case unwrap_rpc(emqx_management_proto_v3:subscribe(Node, ClientId, TopicTables)) of
|
|
|
@@ -467,7 +467,7 @@ publish(Msg) ->
|
|
|
-spec unsubscribe(emqx_types:clientid(), emqx_types:topic()) ->
|
|
|
{unsubscribe, _} | {error, channel_not_found}.
|
|
|
unsubscribe(ClientId, Topic) ->
|
|
|
- unsubscribe(mria_mnesia:running_nodes(), ClientId, Topic).
|
|
|
+ unsubscribe(mria:running_nodes(), ClientId, Topic).
|
|
|
|
|
|
-spec unsubscribe([node()], emqx_types:clientid(), emqx_types:topic()) ->
|
|
|
{unsubscribe, _} | {error, channel_not_found}.
|
|
|
@@ -490,7 +490,7 @@ do_unsubscribe(ClientId, Topic) ->
|
|
|
-spec unsubscribe_batch(emqx_types:clientid(), [emqx_types:topic()]) ->
|
|
|
{unsubscribe, _} | {error, channel_not_found}.
|
|
|
unsubscribe_batch(ClientId, Topics) ->
|
|
|
- unsubscribe_batch(mria_mnesia:running_nodes(), ClientId, Topics).
|
|
|
+ unsubscribe_batch(mria:running_nodes(), ClientId, Topics).
|
|
|
|
|
|
-spec unsubscribe_batch([node()], emqx_types:clientid(), [emqx_types:topic()]) ->
|
|
|
{unsubscribe_batch, _} | {error, channel_not_found}.
|
|
|
@@ -515,7 +515,7 @@ do_unsubscribe_batch(ClientId, Topics) ->
|
|
|
%%--------------------------------------------------------------------
|
|
|
|
|
|
get_alarms(Type) ->
|
|
|
- [{Node, get_alarms(Node, Type)} || Node <- mria_mnesia:running_nodes()].
|
|
|
+ [{Node, get_alarms(Node, Type)} || Node <- mria:running_nodes()].
|
|
|
|
|
|
get_alarms(Node, Type) ->
|
|
|
add_duration_field(unwrap_rpc(emqx_proto_v1:get_alarms(Node, Type))).
|
|
|
@@ -524,7 +524,7 @@ deactivate(Node, Name) ->
|
|
|
unwrap_rpc(emqx_proto_v1:deactivate_alarm(Node, Name)).
|
|
|
|
|
|
delete_all_deactivated_alarms() ->
|
|
|
- [delete_all_deactivated_alarms(Node) || Node <- mria_mnesia:running_nodes()].
|
|
|
+ [delete_all_deactivated_alarms(Node) || Node <- mria:running_nodes()].
|
|
|
|
|
|
delete_all_deactivated_alarms(Node) ->
|
|
|
unwrap_rpc(emqx_proto_v1:delete_all_deactivated_alarms(Node)).
|