Skip to content

Commit

Permalink
Print kiss tables in mongoosectl mnesia info
Browse files Browse the repository at this point in the history
  • Loading branch information
arcusfelis committed Mar 6, 2022
1 parent 30d1fa0 commit 8add6ca
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rebar.lock
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
0},
{<<"kiss">>,
{git,"https://github.com/arcusfelis/kiss.git",
{ref,"13c701e0eeeb7ade2c1518f54bea416578591ae5"}},
{ref,"8e803b23060ab691b1971c1e6a4985642eae74bd"}},
0},
{<<"lager">>,{pkg,<<"lager">>,<<"3.9.2">>},0},
{<<"lasse">>,{pkg,<<"lasse">>,<<"1.2.0">>},0},
Expand Down
13 changes: 13 additions & 0 deletions src/ejabberd_ctl.erl
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ process(["mnesia"]) ->
?STATUS_SUCCESS;
process(["mnesia", "info"]) ->
mnesia:info(),
kiss_info(),
?STATUS_SUCCESS;
process(["mnesia", Arg]) when is_list(Arg) ->
case catch mnesia:system_info(list_to_atom(Arg)) of
Expand Down Expand Up @@ -928,3 +929,15 @@ get_dist_proto() ->
_ -> "inet_tcp"
end.

kiss_info() ->
Tables = kiss_discovery:info(mongoose_kiss_discovery),
kiss_info(Tables).

kiss_info([]) ->
ok;
kiss_info(Tables) ->
?PRINT("Kiss tables:~n", []),
[kiss_table_info(Table) || Table <- Tables].

kiss_table_info(#{memory := Memory, size := Size, nodes := Nodes, table := Tab}) ->
?PRINT("table=~0p size=~p memory=~0p words nodes=~0p~n", [Tab, Size, Memory, Nodes]).

0 comments on commit 8add6ca

Please sign in to comment.