Skip to content

Commit

Permalink
Rename mongoose_muc_online_backend to mod_muc_online_backend
Browse files Browse the repository at this point in the history
  • Loading branch information
arcusfelis committed Dec 1, 2023
1 parent bd38ca9 commit b630713
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion big_tests/tests/mongoose_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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() ->
Expand Down
2 changes: 1 addition & 1 deletion big_tests/tests/muc_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
16 changes: 8 additions & 8 deletions src/muc/mod_muc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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()].
Expand All @@ -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},
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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}) ->
Expand All @@ -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() ->
Expand Down Expand Up @@ -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).

Check warning on line 1165 in src/muc/mod_muc.erl

View check run for this annotation

Codecov / codecov/patch

src/muc/mod_muc.erl#L1165

Added line #L1165 was not covered by tests

-spec get_persistent_vh_rooms(muc_host()) -> [muc_room()].
get_persistent_vh_rooms(MucHost) ->
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-module(mongoose_muc_online_backend).
-module(mod_muc_online_backend).

-export([start/2,
stop/1,
Expand All @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
14 changes: 7 additions & 7 deletions test/mongoose_cleanup_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -264,19 +264,19 @@ 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,
MucHost = <<"muc.localhost">>,
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
Expand Down Expand Up @@ -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},
Expand Down

0 comments on commit b630713

Please sign in to comment.