From b63071354ba78ca945bf00e4bbaaa59d5a0c2996 Mon Sep 17 00:00:00 2001 From: Mikhail Uvarov Date: Fri, 1 Dec 2023 17:26:32 +0100 Subject: [PATCH] Rename mongoose_muc_online_backend to mod_muc_online_backend --- big_tests/tests/mongoose_helper.erl | 2 +- big_tests/tests/muc_helper.erl | 2 +- src/muc/mod_muc.erl | 16 ++++++++-------- ...ne_backend.erl => mod_muc_online_backend.erl} | 4 ++-- ...c_online_cets.erl => mod_muc_online_cets.erl} | 4 ++-- ...line_mnesia.erl => mod_muc_online_mnesia.erl} | 4 ++-- test/mongoose_cleanup_SUITE.erl | 14 +++++++------- 7 files changed, 23 insertions(+), 23 deletions(-) rename src/muc/{mongoose_muc_online_backend.erl => mod_muc_online_backend.erl} (97%) rename src/muc/{mongoose_muc_online_cets.erl => mod_muc_online_cets.erl} (98%) rename src/muc/{mongoose_muc_online_mnesia.erl => mod_muc_online_mnesia.erl} (97%) diff --git a/big_tests/tests/mongoose_helper.erl b/big_tests/tests/mongoose_helper.erl index 93aa4248d2c..4fe0c5c65f0 100644 --- a/big_tests/tests/mongoose_helper.erl +++ b/big_tests/tests/mongoose_helper.erl @@ -243,7 +243,7 @@ stop_online_rooms() -> end, rpc(mim(), erlang, exit, [SupervisorPid, kill]), %% That's a pretty dirty way - rpc(mim(), mongoose_muc_online_backend, clear_table, [HostType]), + rpc(mim(), mod_muc_online_backend, clear_table, [HostType]), ok. forget_persistent_rooms() -> diff --git a/big_tests/tests/muc_helper.erl b/big_tests/tests/muc_helper.erl index 8131d6d2092..783a1d4ad4d 100644 --- a/big_tests/tests/muc_helper.erl +++ b/big_tests/tests/muc_helper.erl @@ -182,7 +182,7 @@ destroy_room(Config) -> destroy_room(Host, Room) when is_binary(Host), is_binary(Room) -> HostType = domain_helper:host_type(), Room1 = jid:nodeprep(Room), - case rpc(mim(), mongoose_muc_online_backend, find_room_pid, [HostType, Host, Room1]) of + case rpc(mim(), mod_muc_online_backend, find_room_pid, [HostType, Host, Room1]) of {ok, Pid} -> %% @TODO related to gen_fsm_compat: after migration to gen_statem %% should be replaced to - gen_statem:call(Pid, destroy). diff --git a/src/muc/mod_muc.erl b/src/muc/mod_muc.erl index c497fa17980..89cff3c24d3 100644 --- a/src/muc/mod_muc.erl +++ b/src/muc/mod_muc.erl @@ -164,7 +164,7 @@ start_link(HostType, Opts) -> -spec start(host_type(), _) -> ok. start(HostType, Opts) when is_map(Opts) -> - mongoose_muc_online_backend:start(HostType, Opts), + mod_muc_online_backend:start(HostType, Opts), ensure_metrics(HostType), start_supervisor(HostType), start_server(HostType, Opts), @@ -175,7 +175,7 @@ start(HostType, Opts) when is_map(Opts) -> stop(HostType) -> stop_supervisor(HostType), stop_gen_server(HostType), - mongoose_muc_online_backend:stop(HostType), + mod_muc_online_backend:stop(HostType), ok. -spec supported_features() -> [atom()]. @@ -202,7 +202,7 @@ config_spec() -> items = #{<<"backend">> => #option{type = atom, validate = {module, mod_muc}}, <<"online_backend">> => #option{type = atom, - validate = {module, mongoose_muc_online}}, + validate = {module, mod_muc_online}}, <<"host">> => #option{type = string, validate = subdomain_template, process = fun mongoose_subdomain_utils:make_subdomain_pattern/1}, @@ -371,7 +371,7 @@ stop_gen_server(HostType) -> %% So the message sending must be catched -spec room_destroyed(host_type(), jid:server(), room(), pid()) -> 'ok'. room_destroyed(HostType, MucHost, Room, Pid) -> - mongoose_muc_online_backend:room_destroyed(HostType, MucHost, Room, Pid). + mod_muc_online_backend:room_destroyed(HostType, MucHost, Room, Pid). %% @doc Create a room. %% If Opts = default, the default room options are used. @@ -914,7 +914,7 @@ register_room_or_stop_if_duplicate(HostType, MucHost, Room, Pid) -> -spec register_room(HostType :: host_type(), jid:server(), room(), pid()) -> ok | {exists, pid()} | {error, term()}. register_room(HostType, MucHost, Room, Pid) -> - mongoose_muc_online_backend:register_room(HostType, MucHost, Room, Pid). + mod_muc_online_backend:register_room(HostType, MucHost, Room, Pid). -spec room_jid_to_pid(RoomJID :: jid:jid()) -> {ok, pid()} | {error, not_found}. room_jid_to_pid(#jid{luser = Room, lserver = MucHost}) -> @@ -926,7 +926,7 @@ room_jid_to_pid(#jid{luser = Room, lserver = MucHost}) -> end. find_room_pid(HostType, MucHost, Room) -> - mongoose_muc_online_backend:find_room_pid(HostType, MucHost, Room). + mod_muc_online_backend:find_room_pid(HostType, MucHost, Room). -spec default_host() -> mongoose_subdomain_utils:subdomain_pattern(). default_host() -> @@ -1162,7 +1162,7 @@ broadcast_service_message(MucHost, Msg) -> -spec get_vh_rooms(muc_host()) -> [muc_online_room()]. get_vh_rooms(MucHost) -> {ok, HostType} = mongoose_domain_api:get_subdomain_host_type(MucHost), - mongoose_muc_online_backend:get_online_rooms(HostType, MucHost). + mod_muc_online_backend:get_online_rooms(HostType, MucHost). -spec get_persistent_vh_rooms(muc_host()) -> [muc_room()]. get_persistent_vh_rooms(MucHost) -> @@ -1176,7 +1176,7 @@ get_persistent_vh_rooms(MucHost) -> -spec node_cleanup(host_type(), node()) -> ok. node_cleanup(HostType, Node) -> - mongoose_muc_online_backend:node_cleanup(HostType, Node). + mod_muc_online_backend:node_cleanup(HostType, Node). %%==================================================================== %% Hooks handlers diff --git a/src/muc/mongoose_muc_online_backend.erl b/src/muc/mod_muc_online_backend.erl similarity index 97% rename from src/muc/mongoose_muc_online_backend.erl rename to src/muc/mod_muc_online_backend.erl index ab8528bd190..5c7d6c1c6da 100644 --- a/src/muc/mongoose_muc_online_backend.erl +++ b/src/muc/mod_muc_online_backend.erl @@ -1,4 +1,4 @@ --module(mongoose_muc_online_backend). +-module(mod_muc_online_backend). -export([start/2, stop/1, @@ -12,7 +12,7 @@ %% Used in tests -ignore_xref([clear_table/1]). --define(MAIN_MODULE, mongoose_muc_online). +-define(MAIN_MODULE, mod_muc_online). %% Callbacks diff --git a/src/muc/mongoose_muc_online_cets.erl b/src/muc/mod_muc_online_cets.erl similarity index 98% rename from src/muc/mongoose_muc_online_cets.erl rename to src/muc/mod_muc_online_cets.erl index e7e3dce191c..8bc68139914 100644 --- a/src/muc/mongoose_muc_online_cets.erl +++ b/src/muc/mod_muc_online_cets.erl @@ -1,5 +1,5 @@ --module(mongoose_muc_online_cets). --behaviour(mongoose_muc_online_backend). +-module(mod_muc_online_cets). +-behaviour(mod_muc_online_backend). -export([start/2, stop/1, diff --git a/src/muc/mongoose_muc_online_mnesia.erl b/src/muc/mod_muc_online_mnesia.erl similarity index 97% rename from src/muc/mongoose_muc_online_mnesia.erl rename to src/muc/mod_muc_online_mnesia.erl index a6f010de310..b4092e034f7 100644 --- a/src/muc/mongoose_muc_online_mnesia.erl +++ b/src/muc/mod_muc_online_mnesia.erl @@ -1,5 +1,5 @@ --module(mongoose_muc_online_mnesia). --behaviour(mongoose_muc_online_backend). +-module(mod_muc_online_mnesia). +-behaviour(mod_muc_online_backend). -export([start/2, stop/1, diff --git a/test/mongoose_cleanup_SUITE.erl b/test/mongoose_cleanup_SUITE.erl index 72822d01a1f..3af3acae48c 100644 --- a/test/mongoose_cleanup_SUITE.erl +++ b/test/mongoose_cleanup_SUITE.erl @@ -264,9 +264,9 @@ muc_room(_Config) -> Pid = remote_pid(), Node = node(Pid), Room = <<"remote_room">>, - ok = mongoose_muc_online_backend:register_room(HostType, MucHost, Room, Pid), - ok = mongoose_muc_online_backend:node_cleanup(HostType, Node), - {error, not_found} = mongoose_muc_online_backend:find_room_pid(HostType, MucHost, Room). + ok = mod_muc_online_backend:register_room(HostType, MucHost, Room, Pid), + ok = mod_muc_online_backend:node_cleanup(HostType, Node), + {error, not_found} = mod_muc_online_backend:find_room_pid(HostType, MucHost, Room). muc_room_from_other_node_remains(_Config) -> HostType = ?HOST, @@ -274,9 +274,9 @@ muc_room_from_other_node_remains(_Config) -> Pid = self(), RemoteNode = node(remote_pid()), Room = <<"room_on_other_node">>, - ok = mongoose_muc_online_backend:register_room(HostType, MucHost, Room, Pid), - ok = mongoose_muc_online_backend:node_cleanup(HostType, RemoteNode), - {ok, Pid} = mongoose_muc_online_backend:find_room_pid(HostType, MucHost, Room). + ok = mod_muc_online_backend:register_room(HostType, MucHost, Room, Pid), + ok = mod_muc_online_backend:node_cleanup(HostType, RemoteNode), + {ok, Pid} = mod_muc_online_backend:find_room_pid(HostType, MucHost, Room). %% ----------------------------------------------------- %% Internal @@ -376,7 +376,7 @@ start_muc(TestCase, Config) -> end. start_muc_backend(Backend) -> - mongoose_muc_online_backend:start(?HOST, #{online_backend => Backend}). + mod_muc_online_backend:start(?HOST, #{online_backend => Backend}). start_muc_module(Backend) -> ExtraOpts = #{online_backend => Backend, backend => mnesia},