Skip to content

Removed explicit module references when they refer to functions in the same module #10477

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions deps/rabbit/src/rabbit_amqqueue.erl
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ maybe_rebalance({true, Id}, Type, VhostSpec, QueueSpec) ->
[Type, VhostSpec, QueueSpec]),
Running = rabbit_maintenance:filter_out_drained_nodes_consistent_read(rabbit_nodes:list_running()),
NumRunning = length(Running),
ToRebalance = [Q || Q <- rabbit_amqqueue:list(),
ToRebalance = [Q || Q <- list(),
filter_per_type(Type, Q),
is_replicated(Q),
is_match(amqqueue:get_vhost(Q), VhostSpec) andalso
Expand Down Expand Up @@ -1138,7 +1138,7 @@ list() ->
count() ->
rabbit_db_queue:count().

-spec list_names() -> [rabbit_amqqueue:name()].
-spec list_names() -> [name()].

list_names() ->
rabbit_db_queue:list().
Expand Down Expand Up @@ -1169,7 +1169,7 @@ is_down(Q) ->
-spec sample_local_queues() -> [amqqueue:amqqueue()].
sample_local_queues() -> sample_n_by_name(list_local_names(), 300).

-spec sample_n_by_name([rabbit_amqqueue:name()], pos_integer()) -> [amqqueue:amqqueue()].
-spec sample_n_by_name([name()], pos_integer()) -> [amqqueue:amqqueue()].
sample_n_by_name([], _N) ->
[];
sample_n_by_name(Names, N) when is_list(Names) andalso is_integer(N) andalso N > 0 ->
Expand All @@ -1183,7 +1183,7 @@ sample_n_by_name(Names, N) when is_list(Names) andalso is_integer(N) andalso N >
end,
[], lists:seq(1, M)),
lists:map(fun (Id) ->
{ok, Q} = rabbit_amqqueue:lookup(Id),
{ok, Q} = lookup(Id),
Q
end,
lists:usort(Ids)).
Expand All @@ -1206,7 +1206,7 @@ list_by_type(stream) -> list_by_type(rabbit_stream_queue);
list_by_type(Type) ->
rabbit_db_queue:get_all_durable_by_type(Type).

-spec list_local_quorum_queue_names() -> [rabbit_amqqueue:name()].
-spec list_local_quorum_queue_names() -> [name()].

list_local_quorum_queue_names() ->
[ amqqueue:get_name(Q) || Q <- list_by_type(quorum),
Expand Down Expand Up @@ -1252,7 +1252,7 @@ list_local_mirrored_classic_queues() ->
is_local_to_node(amqqueue:get_pid(Q), node()),
is_replicated(Q)].

-spec list_local_mirrored_classic_names() -> [rabbit_amqqueue:name()].
-spec list_local_mirrored_classic_names() -> [name()].
list_local_mirrored_classic_names() ->
[ amqqueue:get_name(Q) || Q <- list(),
amqqueue:get_state(Q) =/= crashed,
Expand Down Expand Up @@ -1671,7 +1671,7 @@ delete_with(QueueName, ConnPid, IfUnused, IfEmpty, Username, CheckExclusive) whe
{error, not_empty} ->
rabbit_misc:precondition_failed("~ts not empty", [rabbit_misc:rs(QueueName)]);
{error, {exit, _, _}} ->
%% rabbit_amqqueue:delete()/delegate:invoke might return {error, {exit, _, _}}
%% rabbit_amqqueue:delete/1 or delegate:invoke/2 might return {error, {exit, _, _}}
{ok, 0};
{ok, Count} ->
{ok, Count};
Expand Down Expand Up @@ -2013,8 +2013,7 @@ filter_transient_queues_to_delete(Node) ->
amqqueue:qnode(Q) == Node andalso
not rabbit_process:is_process_alive(amqqueue:get_pid(Q))
andalso (not amqqueue:is_classic(Q) orelse not amqqueue:is_durable(Q))
andalso (not rabbit_amqqueue:is_replicated(Q)
orelse rabbit_amqqueue:is_dead_exclusive(Q))
andalso (not is_replicated(Q) orelse is_dead_exclusive(Q))
andalso amqqueue:get_type(Q) =/= rabbit_mqtt_qos0_queue
end.

Expand Down Expand Up @@ -2129,7 +2128,7 @@ queue_names(Queues)
get_bcc_queue(Q, BCCName) ->
#resource{virtual_host = VHost} = amqqueue:get_name(Q),
BCCQueueName = rabbit_misc:r(VHost, queue, BCCName),
rabbit_amqqueue:lookup(BCCQueueName).
lookup(BCCQueueName).

is_queue_args_combination_permitted(Q) ->
Durable = amqqueue:is_durable(Q),
Expand Down
26 changes: 12 additions & 14 deletions deps/rabbit/src/rabbit_auth_backend_internal.erl
Original file line number Diff line number Diff line change
Expand Up @@ -698,8 +698,8 @@ put_user(User, Version, ActingUser) ->
throw({error, both_password_and_password_hash_are_provided});
%% clear password, update tags if needed
_ ->
rabbit_auth_backend_internal:set_tags(Username, Tags, ActingUser),
rabbit_auth_backend_internal:clear_password(Username, ActingUser)
set_tags(Username, Tags, ActingUser),
clear_password(Username, ActingUser)
end;
false ->
case {HasPassword, HasPasswordHash} of
Expand Down Expand Up @@ -732,37 +732,35 @@ update_user_password_hash(Username, PasswordHash, Tags, Limits, User, Version) -

Hash = rabbit_misc:b64decode_or_throw(PasswordHash),
ConvertedTags = [rabbit_data_coercion:to_atom(I) || I <- Tags],
rabbit_auth_backend_internal:update_user_with_hash(
Username, Hash, HashingAlgorithm, ConvertedTags, Limits).
update_user_with_hash(Username, Hash, HashingAlgorithm, ConvertedTags, Limits).

create_user_with_password(_PassedCredentialValidation = true, Username, Password, Tags, undefined, Limits, ActingUser) ->
ok = rabbit_auth_backend_internal:add_user(Username, Password, ActingUser, Limits, Tags);
ok = add_user(Username, Password, ActingUser, Limits, Tags);
create_user_with_password(_PassedCredentialValidation = true, Username, Password, Tags, PreconfiguredPermissions, Limits, ActingUser) ->
ok = rabbit_auth_backend_internal:add_user(Username, Password, ActingUser, Limits, Tags),
ok = add_user(Username, Password, ActingUser, Limits, Tags),
preconfigure_permissions(Username, PreconfiguredPermissions, ActingUser);
create_user_with_password(_PassedCredentialValidation = false, _Username, _Password, _Tags, _, _, _) ->
%% we don't log here because
%% rabbit_auth_backend_internal will do it
throw({error, credential_validation_failed}).

create_user_with_password_hash(Username, PasswordHash, Tags, User, Version, PreconfiguredPermissions, Limits, ActingUser) ->
%% when a hash this provided, credential validation
%% is not applied
%% when a hash is provided, credential validation is not applied
HashingAlgorithm = hashing_algorithm(User, Version),
Hash = rabbit_misc:b64decode_or_throw(PasswordHash),

rabbit_auth_backend_internal:add_user_sans_validation(Username, Hash, HashingAlgorithm, Tags, Limits, ActingUser),
add_user_sans_validation(Username, Hash, HashingAlgorithm, Tags, Limits, ActingUser),
preconfigure_permissions(Username, PreconfiguredPermissions, ActingUser).

preconfigure_permissions(_Username, undefined, _ActingUser) ->
ok;
preconfigure_permissions(Username, Map, ActingUser) when is_map(Map) ->
_ = maps:map(fun(VHost, M) ->
rabbit_auth_backend_internal:set_permissions(Username, VHost,
maps:get(<<"configure">>, M),
maps:get(<<"write">>, M),
maps:get(<<"read">>, M),
ActingUser)
set_permissions(Username, VHost,
maps:get(<<"configure">>, M),
maps:get(<<"write">>, M),
maps:get(<<"read">>, M),
ActingUser)
end,
Map),
ok.
Expand Down
2 changes: 1 addition & 1 deletion deps/rabbit/src/rabbit_basic.erl
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ msg_size(Content) ->
rabbit_writer:msg_size(Content).

add_header(Name, Type, Value, #basic_message{content = Content0} = Msg) ->
Content = rabbit_basic:map_headers(
Content = map_headers(
fun(undefined) ->
rabbit_misc:set_table_value([], Name, Type, Value);
(Headers) ->
Expand Down
12 changes: 6 additions & 6 deletions deps/rabbit/src/rabbit_binding.erl
Original file line number Diff line number Diff line change
Expand Up @@ -308,13 +308,13 @@ group_bindings_fold(Fun, Acc, [B = #binding{source = SrcName} | Bs],

-spec group_bindings_fold(Fun, Name, Deletions, [Binding], [Binding], OnlyDurable)
-> Ret when
Fun :: fun((Name, [Binding], Deletions, OnlyDurable) ->
Deletions),
Name :: rabbit_exchange:name(),
Deletions :: rabbit_binding:deletions(),
Binding :: rabbit_types:binding(),
Fun :: fun((Name, [Binding], Deletions, OnlyDurable) ->
Deletions),
Name :: rabbit_exchange:name(),
Deletions :: deletions(),
Binding :: rabbit_types:binding(),
OnlyDurable :: boolean(),
Ret :: Deletions.
Ret :: Deletions.
group_bindings_fold(
Fun, SrcName, Acc, [B = #binding{source = SrcName} | Bs], Bindings,
OnlyDurable) ->
Expand Down
3 changes: 1 addition & 2 deletions deps/rabbit/src/rabbit_channel.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1274,8 +1274,7 @@ handle_method(#'basic.publish'{exchange = ExchangeNameBin,
{ok, Message0} ->
Message = rabbit_message_interceptor:intercept(Message0),
QNames = rabbit_exchange:route(Exchange, Message, #{return_binding_keys => true}),
[rabbit_channel:deliver_reply(RK, Message) ||
{virtual_reply_queue, RK} <- QNames],
[deliver_reply(RK, Message) || {virtual_reply_queue, RK} <- QNames],
Queues = rabbit_amqqueue:lookup_many(QNames),
rabbit_trace:tap_in(Message, QNames, ConnName, ChannelNum,
Username, TraceState),
Expand Down
6 changes: 3 additions & 3 deletions deps/rabbit/src/rabbit_connection_tracking.erl
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ handle_cast({vhost_deleted, Details}) ->
delete_tracked_connection_vhost_entry, [VHost]),
rabbit_log_connection:info("Closing all connections in vhost '~ts' because it's being deleted", [VHost]),
shutdown_tracked_items(
rabbit_connection_tracking:list(VHost),
list(VHost),
rabbit_misc:format("vhost '~ts' is deleted", [VHost]));
%% Note: under normal circumstances this will be called immediately
%% after the vhost_deleted above. Therefore we should be careful about
Expand All @@ -120,7 +120,7 @@ handle_cast({vhost_down, Details}) ->
" because the vhost is stopping",
[VHost, Node]),
shutdown_tracked_items(
rabbit_connection_tracking:list_on_node(Node, VHost),
list_on_node(Node, VHost),
rabbit_misc:format("vhost '~ts' is down", [VHost]));
handle_cast({user_deleted, Details}) ->
Username = pget(name, Details),
Expand All @@ -129,7 +129,7 @@ handle_cast({user_deleted, Details}) ->
delete_tracked_connection_user_entry, [Username]),
rabbit_log_connection:info("Closing all connections for user '~ts' because the user is being deleted", [Username]),
shutdown_tracked_items(
rabbit_connection_tracking:list_of_user(Username),
list_of_user(Username),
rabbit_misc:format("user '~ts' is deleted", [Username])).

-spec register_tracked(rabbit_types:tracked_connection()) -> ok.
Expand Down
2 changes: 1 addition & 1 deletion deps/rabbit/src/rabbit_db_binding.erl
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ clear_in_mnesia() ->
ok.

clear_in_khepri() ->
Path = rabbit_db_binding:khepri_routes_path(),
Path = khepri_routes_path(),
case rabbit_khepri:delete(Path) of
ok -> ok;
Error -> throw(Error)
Expand Down
14 changes: 7 additions & 7 deletions deps/rabbit/src/rabbit_db_cluster.erl
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ can_join_using_khepri(RemoteNode) ->

-spec join(RemoteNode, NodeType) -> Ret when
RemoteNode :: node(),
NodeType :: rabbit_db_cluster:node_type(),
Ret :: Ok | Error,
Ok :: ok | {ok, already_member},
Error :: {error, {inconsistent_cluster, string()}}.
NodeType :: node_type(),
Ret :: Ok | Error,
Ok :: ok | {ok, already_member},
Error :: {error, {inconsistent_cluster, string()}}.
%% @doc Adds this node to a cluster using `RemoteNode' to reach it.

join(ThisNode, _NodeType) when ThisNode =:= node() ->
Expand Down Expand Up @@ -254,7 +254,7 @@ forget_member_using_khepri(Node, false = _RemoveWhenOffline) ->
%% -------------------------------------------------------------------

-spec change_node_type(NodeType) -> ok when
NodeType :: rabbit_db_cluster:node_type().
NodeType :: node_type().
%% @doc Changes the node type to `NodeType'.
%%
%% Node types may not all be valid with all databases.
Expand Down Expand Up @@ -320,7 +320,7 @@ disc_members_using_mnesia() ->
rabbit_mnesia:cluster_nodes(disc).

-spec node_type() -> NodeType when
NodeType :: rabbit_db_cluster:node_type().
NodeType :: node_type().
%% @doc Returns the type of this node, `disc' or `ram'.
%%
%% Node types may not all be relevant with all databases.
Expand Down Expand Up @@ -373,7 +373,7 @@ check_consistency_using_khepri() ->
rabbit_khepri:check_cluster_consistency().

-spec cli_cluster_status() -> ClusterStatus when
ClusterStatus :: [{nodes, [{rabbit_db_cluster:node_type(), [node()]}]} |
ClusterStatus :: [{nodes, [{node_type(), [node()]}]} |
{running_nodes, [node()]} |
{partitions, [{node(), [node()]}]}].
%% @doc Returns information from the cluster for the `cluster_status' CLI
Expand Down
2 changes: 1 addition & 1 deletion deps/rabbit/src/rabbit_exchange.erl
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ list() ->
count() ->
rabbit_db_exchange:count().

-spec list_names() -> [rabbit_exchange:name()].
-spec list_names() -> [name()].

list_names() ->
rabbit_db_exchange:list().
Expand Down
2 changes: 1 addition & 1 deletion deps/rabbit/src/rabbit_fifo.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ handle_aux(_RaState, {call, _From}, oldest_entry_timestamp,
end;
handle_aux(_RaState, {call, _From}, {peek, Pos}, Aux0,
Log0, MacState) ->
case rabbit_fifo:query_peek(Pos, MacState) of
case query_peek(Pos, MacState) of
{ok, ?MSG(Idx, Header)} ->
%% need to re-hydrate from the log
{{_, _, {_, _, Cmd, _}}, Log} = ra_log:fetch(Idx, Log0),
Expand Down
4 changes: 2 additions & 2 deletions deps/rabbit/src/rabbit_mirror_queue_misc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ stop_all_slaves(Reason, SPids, QName, GM, WaitTimeout) ->
{'DOWN', MRef, process, _Pid, _Info} ->
Acc
after WaitTimeout ->
rabbit_mirror_queue_misc:log_warning(
log_warning(
QName, "Missing 'DOWN' message from ~tp in"
" node ~tp", [Pid, node(Pid)]),
[Pid | Acc]
Expand Down Expand Up @@ -582,7 +582,7 @@ remove_all_slaves_in_mnesia(QName, PendingSlavePids) ->
%% ensure old incarnations are stopped using
%% the pending mirror pids.
Q3 = amqqueue:set_slave_pids_pending_shutdown(Q2, PendingSlavePids),
rabbit_mirror_queue_misc:store_updated_slaves(Q3)
store_updated_slaves(Q3)
end).

remove_all_slaves_in_khepri(QName, PendingSlavePids) ->
Expand Down
2 changes: 1 addition & 1 deletion deps/rabbit/src/rabbit_mnesia.erl
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ cluster_status(WhichNodes) ->
end.

members() ->
case rabbit_mnesia:is_running() andalso rabbit_table:is_present() of
case is_running() andalso rabbit_table:is_present() of
true ->
%% If Mnesia is running locally and some tables exist, we can know
%% the database was initialized and we can query the list of
Expand Down
2 changes: 1 addition & 1 deletion deps/rabbit/src/rabbit_vhost_limit.erl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ list(VHost) ->
-spec is_over_connection_limit(vhost:name()) -> {true, non_neg_integer()} | false.

is_over_connection_limit(VirtualHost) ->
case rabbit_vhost_limit:connection_limit(VirtualHost) of
case connection_limit(VirtualHost) of
%% no limit configured
undefined -> false;
%% with limit = 0, no connections are allowed
Expand Down
2 changes: 1 addition & 1 deletion deps/rabbit/src/rabbit_vhost_sup_sup.erl
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ check() ->
VHosts = rabbit_vhost:list_names(),
lists:filter(
fun(V) ->
case rabbit_vhost_sup_sup:get_vhost_sup(V) of
case get_vhost_sup(V) of
{ok, Sup} ->
MsgStores = [Pid || {Name, Pid, _, _} <- supervisor:which_children(Sup),
lists:member(Name, [msg_store_persistent,
Expand Down
2 changes: 1 addition & 1 deletion deps/rabbit/src/vhost.erl
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,6 @@ merge_metadata(VHost, Value) ->
NewMeta = maps:merge(Meta0, Value),
VHost#vhost{metadata = NewMeta}.

-spec is_tagged_with(vhost:vhost(), tag()) -> boolean().
-spec is_tagged_with(vhost(), tag()) -> boolean().
is_tagged_with(VHost, Tag) ->
lists:member(Tag, get_tags(VHost)).
2 changes: 1 addition & 1 deletion deps/rabbit_common/src/rabbit_misc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ deep_pget([], P, _) ->
P;

deep_pget([K|Ks], P, D) ->
case rabbit_misc:pget(K, P, D) of
case pget(K, P, D) of
D -> D;
Pn -> deep_pget(Ks, Pn, D)
end.
Expand Down
2 changes: 1 addition & 1 deletion deps/rabbit_common/src/rabbit_types.erl
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
host :: rabbit_net:hostname(),
port :: rabbit_net:ip_port()}).

-type rabbit_amqqueue_name() :: rabbit_types:r('queue').
-type rabbit_amqqueue_name() :: r('queue').

-type(binding_source() :: exchange_name()).
-type(binding_destination() :: rabbit_amqqueue_name() | exchange_name()).
Expand Down
Loading